httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Verbeeck <Kris.Verbe...@ubizen.com>
Subject [PATCH] Re: Cached response: 304 send as 200
Date Wed, 11 Sep 2002 14:40:15 GMT
Hi,

Attached is a patch that will solve the 304 turning into 200 response code
problem.  It seems that in mod_disk_cache the status line was also saved
and restored from the cache.  On a first request it is saved as "200 OK" or
something to the cache file.  On subsequent requests it is restored into
r->status_line.

The problem occurs when afterwards mod_cache decides that the response
should be a "304 not modified".  The status line is not reset in this case
and send as a "200 OK" response without a body.

The solution: not restoring the status line from the cache.  The http
response header filter will then construct a status line starting from
the status code, which is 304.  Problem solved.

Kris Verbeeck wrote:
> 
> Hi,
> 
> When refreshing a page (with IE) the browser sends a 'If-Modified-Since'
> header in the request.  As seen in the debug log below, mod_cache has
> verified that the page has not been modified and wants to return an HTTP
> status 304.  Somehow this 304 doesn't get to the browser.  Instead of
> sending the 304 response apache sends a 200 response without a body
> (see ethereal output of request and response below).  This results in the
> browser displaying an empty (white) page.
> 
> If a request is send without the 'If-Modified-Since' header then everything
> works OK, i.e. a 200 response is send with the cached body.
> 
> I have already been tracing through httpd with gdb, but found nothing.
> Does anyone have any idea about what is going on with the 304 response?
> 
> Setup: apache httpd 2.0.40 (with cache patches from CVS)
> 
> The request:
> 
>         GET /index.html HTTP/1.1
>         Accept: */*
>         Accept-Language: en-us
>         Accept-Encoding: gzip, deflate
>         If-Modified-Since: Thu, 02 May 2002 12:01:37 GMT; length=8809
>         User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
>         Host: pino.be.ubizen.com
>         Connection: Keep-Alive
> 
> The response:
> 
>         HTTP/1.0 200
>         Date: Tue, 10 Sep 2002 09:45:39 GMT
>         Server: web server
>         Connection: close
>         etag: "b9829-2269-3cd12aa1"
> 
> The debug log:
> 
>         [date] [debug] mod_cache.c(112): cache: URL /index.html is being handled by disk
>         [date] [info] disk_cache: Serving Cached URL /index.html
>         [date] [info] disk_cache: Served headers for URL /index.html
>         [date] [debug] mod_cache.c(216): cache: fresh cache - returning status 304
> 
> --
> ir. Kris Verbeeck
> Development Engineer
> 
> Ubizen - Ubicenter - Philipssite 5 - 3001 Leuven - Belgium
> T:  +32 16 28 70 64
> F:  +32 16 28 70 77
> 
> Ubizen - We Secure e-business - www.ubizen.com

-- 
ir. Kris Verbeeck
Development Engineer

Ubizen - Ubicenter - Philipssite 5 - 3001 Leuven - Belgium
T:  +32 16 28 70 64
F:  +32 16 28 70 77

Ubizen - We Secure e-business - www.ubizen.com

Mime
View raw message