LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Bug Reports > [RESOLVED] autoindex size bug

Reply
 
Thread Tools Display Modes
  #1  
Old 03-09-2010, 08:11 AM
justme justme is offline
Member
 
Join Date: Feb 2008
Posts: 35
Default [RESOLVED] autoindex size bug

Hello,
using lsws standard 4.0.13 on linux, autoindex can't display file sizes above 2GB (unsigned int), it shows negatives or wrapped numbers instead.

Last edited by NiteWave; 03-12-2010 at 06:50 PM..
Reply With Quote
  #2  
Old 03-09-2010, 09:03 AM
justme justme is offline
Member
 
Join Date: Feb 2008
Posts: 35
Fixed by replacing line 161 of /usr/local/lsws/share/autoindex/default.php
with
$fileStat->size = (float) exec('stat -c %s '.escapeshellarg("$path$file"));
Reply With Quote
  #3  
Old 03-10-2010, 07:38 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,585
You can try
$fileStat->size = sprintf("%u", $s[7]);

it limit to 4GB due to PHP limits on 32bit system.
Reply With Quote
  #4  
Old 03-10-2010, 07:41 AM
justme justme is offline
Member
 
Join Date: Feb 2008
Posts: 35
Actually my solution works except for one thing, utf-8 named files. It is also broken when browsing so it is not only related to file sizes.
Do you have a recommended php configuration? I tried to force the location to define default charset as utf-8 but it doesn't work (content-type does not contain charset).
Reply With Quote
  #5  
Old 03-11-2010, 05:09 AM
justme justme is offline
Member
 
Join Date: Feb 2008
Posts: 35
I got it all working with adding
<meta http-equiv=\"Content-type\" content=\"text/html; charset=UTF-8\"/>

and fixing:
$uri = htmlentities($uri,ENT_COMPAT,"UTF-8");

$fileStat->size = 512*$s[12]; (works for files <2TB in size )
Reply With Quote
  #6  
Old 03-11-2010, 07:56 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,585
Thanks for the fix, we will apply the change to next release.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:14 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.