httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <r...@imdb.com>
Subject Re: Suggested change to directory listings
Date Sat, 17 Aug 1996 21:59:36 GMT

Sounds reasonable Joel. I'll pass the patch on to the developers
list.

regards,
rob


Joel Shprentz I02094 wrote:
>
>This is not so much a bug as a misleading feature.  When Apache 1.1.1
>lists a directory, file sizes are truncated to the next lowest kilobyte
>or megabyte.  Users have complained that 1.8 Mb files are listed as 1 Mb.
>That's a big difference when estimating download times on slow connections.
>
>I recommend altering the code for send_size in util_script to:
>
>	1.  round instead of truncate, and
>	2.  report fractional megabytes.
>
>The patch at the end of this message implements those changes.
>--
>Joel Shprentz			shprentz@bdm.com
>BDM Federal, Inc.		(202) 863-3487
>1501 BDM Way
>McLean, Virginia 22102
>
>------------------------ Cut Here ------------------------------------
>*** util_script.c.orig	Sat Aug 17 15:38:16 1996
>--- util_script.c	Sat Aug 17 15:41:55 1996
>***************
>*** 327,335 ****
>      else if(size < 1024) 
>          strcpy(ss, "   1k");
>      else if(size < 1048576)
>!         sprintf(ss, "%4dk", size / 1024);
>      else
>!         sprintf(ss, "%4dM", size / 1048576);
>      rputs(ss, r);
>  }
>  
>--- 327,337 ----
>      else if(size < 1024) 
>          strcpy(ss, "   1k");
>      else if(size < 1048576)
>!         sprintf(ss, "%4dk", (size + 512) / 1024);
>!     else if(size < 103809024)
>! 	sprintf(ss, "%4.1fM", size / 1048576.0);
>      else
>!         sprintf(ss, "%4dM", (size + 524288) / 1048576);
>      rputs(ss, r);
>  }
>  
>


-- 
Rob Hartill (robh@imdb.com)
The Internet Movie Database (IMDb)  http://www.imdb.com/
           ...more movie info than you can poke a stick at.

Mime
View raw message