polipo icon indicating copy to clipboard operation
polipo copied to clipboard

Warning headers are probably incorrect

Open jech opened this issue 11 years ago • 1 comments

The code for generating HTTP Warning headers is dodgy, and probably provides incorrect data in some cases.

jech avatar May 13 '14 16:05 jech

For example, Polipo generates 110 - "Response is Stale" when the origin server’s response contains an Expires in the past (which is often done to prevent caching):

$ curl --proxy http://localhost:8123 -siG httpbin.org/response-headers \
>     --data-urlencode 'Expires=Sat, 30 Jan 2016 11:55:00 GMT'
HTTP/1.1 200 OK
Content-Length: 116
Date: Sat, 30 Jan 2016 11:55:46 GMT
Expires: Sat, 30 Jan 2016 11:55:00 GMT
Via: 1.1 polipo
Server: nginx
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Connection: keep-alive
Warning: 110 polipo:8123 Object is stale

{
  "Content-Length": "116", 
  "Content-Type": "application/json", 
  "Expires": "Sat, 30 Jan 2016 11:55:00 GMT"
}

As a general rule:

1xx warn-codes describe the freshness or validation status of the response, and so they MUST be deleted by a cache after validation. They can only be generated by a cache when validating a cached entry, and MUST NOT be generated in any other situation.

vfaronov avatar Jan 30 '16 11:01 vfaronov