DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25516>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25516

mod_cache does not cache if no Content-Length specified

           Summary: mod_cache does not cache if no Content-Length specified
           Product: Apache httpd-2.0
           Version: 2.0.48
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: mod_cache
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


mod_cache doesn't cache local URIs that specify no content length. This is
annoying for dynamically generated content, where you hardly know in advance how
much bytes you are going to output. This is evidenced by a simple PHP script :

$ cat cache_arton.php
<?php
 
header("Last-Modified: Tue, 25 Nov 2003 16:58:44 GMT");
//header("Content-Length: 15084");
header("Content-Type: image/jpeg");
 
readfile("spip-current/IMG/arton1754.jpg");
 
?>


Without Content-Length, it isn't cached and doesn't appear in /var/cache/http :
$ curl -I http://127.0.0.1/cache_arton.php
HTTP/1.1 200 OK
Date: Sun, 14 Dec 2003 23:13:47 GMT
Server: Apache-AdvancedExtranetServer/2.0.48 (Mandrake Linux/2mdk) PHP/4.3.4
X-Powered-By: PHP/4.3.4
Last-Modified: Tue, 25 Nov 2003 16:58:44 GMT
Content-Type: image/jpeg
 

If I uncomment the Content-Length header, it gets cached (and appears in
/var/cache/http):
$ curl -I http://127.0.0.1/cache_arton.php
HTTP/1.1 200 OK
Date: Sun, 14 Dec 2003 23:11:32 GMT
Server: Apache-AdvancedExtranetServer/2.0.48 (Mandrake Linux/2mdk) PHP/4.3.4
X-Powered-By: PHP/4.3.4
Last-Modified: Tue, 25 Nov 2003 16:58:44 GMT
Content-Length: 15084
Content-Type: text/plain
Age: 10


The question is : how to do when I simply can't know in advance how many bytes
my PHP script will return ? I do set both Expires and Last-Modified headers, but
it's not enough. Browsers do cache the content on the client side, but on the
server side mod_cache doesn't ;(

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to