Hi, I'm trying to get my script to work with conditional get, however,
when the browser should use the local copy it doesn't display anything,
just telling me that the image's broken. I get the image from a
database, the snippet that sends it is this:
$R->content_type ($data {mimetype});
$R->set_content_length ($data {size});
$R->header_out ('ETag',$data {md5});
$R->send_http_header;
return OK () if ($R->header_only);
if ((my $rc = $R->meets_conditions) != OK) {
return $rc;
}
print $file->get ('data');
If I comment out $R->send_http_header, the apache logs show full size
for the request that doesn't meet conditions, otherwise it shows 0
bytes. In both cases, when supposedly serving from its cache, the
browser hangs for a few seconds.
The logs look like these; the first line is for a request that meets
conditions, the second for one that does not.
192.168.255.2 - - [25/Oct/2002:21:21:43 -0200] "GET /binfile.pl?id=32
HTTP/1.1" 200 148087 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.2b) Gecko/20021016"
192.168.255.2 - - [25/Oct/2002:21:25:28 -0200] "GET /binfile.pl?id=32
HTTP/1.1" 200 - "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.2b) Gecko/20021016"
If I comment out the last return, it works perfectly. I copied the code
from mod_perl's docs, from the section about correct headers.
Thanks in advance.
Cristóvão
- RE: conditional get Cristóvão Dalla Costa
- RE: conditional get Kyle Oppenheim
- Re: conditional get Geoffrey Young
- Apache::Clean, Apache::Compress, mod_gz... Richard Clarke
- Re: Apache::Clean, Apache::Compress... Slava Bizyayev
- Re: Apache::Clean, Apache::Com... Ged Haywood
- Re: Apache::Clean, Apache:... Slava Bizyayev
- Re: Apache::Clean, Apa... Per Einar Ellefsen
- Re: Apache::Clean, Apa... Slava Bizyayev
- Re: Apache::Clean, Apache::Compress... Perrin Harkins
- Re: Apache::Clean, Apache::Compress... Igor Sysoev