One of my users noticed that when squid generates an error page
it doesn't have an HTTP header. It does have the correct HTML,
but there isn't an HTTP result code, nor is there a content-length
header or an 'expires' header. My interpretation of RFC 2068 is
that squid should be sending the status line, with the appropriate
status code and reason phrase, something like:
HTTP/1.0 200 OK
RFC 2068 also says that HTTP/1.1 caches MUST send an 'Age' header
with every response (section 14.6). It also says in section 14.9.4
that if the cache cannot reach the origin server for any reason, it MUST
generate a 504 (Gateway Timeout) response. Section 14.14 implies
the 'Content-Length' header is optional, although it SHOULD be sent.
Sending the 'Expires' header would probably be a good idea, so
the local browser would cache the data for only a short time.
I don't think following every bit of the standard would create
helpful error messages. What will the browser do if every
error page came back with the '504' response? Will it print
out the error page, or will it ignore the rest of the data?
It doesn't make sense to send the '200' response code, because
then it looks like the request succeeded, when it actually failed.
The best thing to do would be to send an invalid '4XX' code, like
499. RFC 2068 in section 6.1.1 says:
For example, if an unrecognized status code of 431 is received
by the client, it can safely assume that there was something wrong
with its request and treat the response as if it had received a
400 status code. In such cases, user agents SHOULD present to
the user the entity returned with the response, since that entity
is likely to include human-readable information which will explain
the unusual status.
The error-page generator should probably create a little header
like the following before sending the error page:
HTTP/1.0 499 Squid detected an error
Age: 1
Date: Mon, 13 Oct 1997 16:01:53 GMT
Expires: Mon, 13 Oct 1997 16:02:53 GMT
I've left out the Content-Length header as it is unclear to
me as to if it is really needed in this case.
What do other people think? Is this a big deal? I'm thinking about
people that use programs to automatically retrieve web pages. Some
of the programs will probably blow up when a Squid error page is returned,
because the error page doesn't have the HTTP header.
-------------------------------------------------------------------------------
Mike Mitchell "Charlie stole the handle and the train
mcm@unx.sas.com it keeps on going, no way to slow down."
(919) 677-8000 X6793 -- Jethro Tull
Received on Mon Oct 13 1997 - 13:14:30 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:37:17 MST