]> git.ipfire.org Git - thirdparty/squid.git/commit
Support configurable status codes for deny_info
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 14 Jan 2011 06:15:23 +0000 (23:15 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 14 Jan 2011 06:15:23 +0000 (23:15 -0700)
commitaed9a15b8fceabd8e4347b4fcca55c7fcafe3335
tree1484c139e615215d5104a6c07d9c33fa871f86cb
parenta91d3505f6d7a6604b9937900de6662195081b57
Support configurable status codes for deny_info

This changes the default behaviour of deny_info redirects. Making Squid
automaticaly select 307 or 303 status code where appropriate for HTTP/1.1
clients and 302 for HTTP/1.0 clients or other appropriate cases.
For example;
    deny_info 303:http://example.com/ POST

On top of the behaviour change this patch adds capability for admin to
configure deny_info with explicit status codes ranging from 200 to 599.

There are limits placed on the use of each range of status codes:
 * 2xx, 4xx and 5xx may only be set when there is a local file or template
   being used as body content on the response.
 * 3xx status may only be set when there is a URI being used as a redirect
   destination.

These limitations are enforced with a configuration hard abort due to:

3xx with a named template and 4xx/5xx with a redirect break with a range
of horrible results to our file loading and output Location: URLs. My
tests ended up with Squid scanning the FS for local files called
http://blah, redirecting the browser to 404:ERR_ACCESS_DENIED, or getting
past those with zero-sized replies and crashes when err is required to
have length.

They are going to take something much more major logic re-plumbing and
maybe deeper cleanup to get the crossover down to safe enough for just a
warning. Given the RFC defined use of each status range I did not think
it worth doing to enable something on the fine edge of non-standard.
src/cf.data.pre
src/errorpage.cc