Well, my explanation was not complete, because I wanted to make sure
I was talking about the right thing. :-)

One important thing I failed to mention is that caching applies to
responses to GET and HEAD requests. If the response you showed us was
a reply to a POST, it is not going to be cached.

As far as the 304 responses are concerned, this depends in part on
the Web browser. For example, if the browser sends a conditional GET
request with an If-Modified-Since header (it has a date as a value),
the Web server will make a decision. If the resource being requested
has in fact been modified since the specified date, the entire
resource is returned in a 200 OK response. If it has remained
unchanged, a 304 Not Modified response is sent with no content,
saving bandwidth.

If you would like a good example to compare responses with, request
an image from your Web server and notice the HTTP headers used. If
you take a page such as Google as an example, your browser requests
http://www.google/com first, receives the HTML from that, then
notices the embedded image and requests
http://www.google.com/images/logo.gif in a separate request. If you
are like me and visit Google all the time, your browser has this
image saved and rarely (usually only on holidays) gets anything but a
304 response from Google.

So, for pages you make available via GET requests that you want to be
cachable in the same way as Google's logo, you can start by mimicking
what they do. Here is an example of the HTTP transactions required to
see http://www.google.com/ (HTML and some headers edited for
readability):

------------------------------
GET / HTTP/1.1
Host: www.google.com
User-Agent: Mozilla/5.0 (...) 
Accept: text/xml, ...
Accept-Language: en-us, en;q=0.50
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Cache-Control: max-age=0
------------------------------
HTTP/1.1 200 OK
Content-Length: 9390
Server: GWS/2.0
Date: Fri, 22 Nov 2002 20:31:18 GMT
Content-Type: text/html
Cache-control: private

<html>...
------------------------------
GET /images/logo.gif HTTP/1.1
Host: www.google.com
User-Agent: Mozilla/5.0 (...)
Accept-Language: en-us, en;q=0.50
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Accept: video/x-mng, ...
Referer: http://www.google.com/
If-Modified-Since: Mon, 21 Oct 2002 02:32:25 GMT
Cache-Control: max-age=0
------------------------------
HTTP/1.1 304 Not Modified
Content-Length: 0
Server: GWS/2.0
Content-Type: text/html
Date: Fri, 22 Nov 2002 20:31:19 GMT
------------------------------

Hopefully that provides a little more information to get you going.

Chris

--- Luanna Silva <[EMAIL PROTECTED]> wrote:

> For the moment, i want to cache the HTTP Response. So, if iīm
> correct, the header that i sent to the list should do the job. 

> I thought that, if the responses were cached, the access.log file
> would have 304 codes on the responses for php scripts. Is that
> correct? Well, if it is, thatīs not happening.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to