From: Amos Jeffries Date: Mon, 21 May 2012 02:35:41 +0000 (-0600) Subject: Register status 308 permanent redirect X-Git-Tag: SQUID_3_2_0_18~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5c005365716c3ea620931f4ba88fb9a115ba140;p=thirdparty%2Fsquid.git Register status 308 permanent redirect * relay "Permanent Redirect" message on status line * MAY cache these responses with heuristics * accept this status as a redirect status from URL redirectors --- diff --git a/src/HttpStatusCode.h b/src/HttpStatusCode.h index 16c4b91a23..7ce73526b8 100644 --- a/src/HttpStatusCode.h +++ b/src/HttpStatusCode.h @@ -24,6 +24,7 @@ typedef enum { HTTP_NOT_MODIFIED = 304, HTTP_USE_PROXY = 305, HTTP_TEMPORARY_REDIRECT = 307, + HTTP_PERMANENT_REDIRECT = 308, HTTP_BAD_REQUEST = 400, HTTP_UNAUTHORIZED = 401, HTTP_PAYMENT_REQUIRED = 402, diff --git a/src/HttpStatusLine.cc b/src/HttpStatusLine.cc index 5b36b08df5..67dc2f3cfc 100644 --- a/src/HttpStatusLine.cc +++ b/src/HttpStatusLine.cc @@ -220,6 +220,10 @@ httpStatusString(http_status status) p = "Temporary Redirect"; break; + case HTTP_PERMANENT_REDIRECT: + p = "Permanent Redirect"; + break; + case HTTP_BAD_REQUEST: p = "Bad Request"; break; diff --git a/src/client_side_request.cc b/src/client_side_request.cc index be2f3e8828..c0848397af 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -1187,6 +1187,7 @@ ClientRequestContext::clientRedirectDone(char *result) if (status == HTTP_MOVED_PERMANENTLY || status == HTTP_MOVED_TEMPORARILY || status == HTTP_SEE_OTHER + || status == HTTP_PERMANENT_REDIRECT || status == HTTP_TEMPORARY_REDIRECT) { char *t = result; @@ -1195,10 +1196,7 @@ ClientRequestContext::clientRedirectDone(char *result) http->redirect.location = xstrdup(t + 1); // TODO: validate the URL produced here is RFC 2616 compliant absolute URI } else { - if (old_request->http_ver < HttpVersion(1,1)) - debugs(85, DBG_CRITICAL, "ERROR: URL-rewrite produces invalid 302 redirect Location: " << result); - else - debugs(85, DBG_CRITICAL, "ERROR: URL-rewrite produces invalid 303 redirect Location: " << result); + debugs(85, DBG_CRITICAL, "ERROR: URL-rewrite produces invalid " << status << " redirect Location: " << result); } } else if (strcmp(result, http->uri)) { // XXX: validate the URL properly *without* generating a whole new request object right here. diff --git a/src/http.cc b/src/http.cc index 63f78bac35..edd96bb091 100644 --- a/src/http.cc +++ b/src/http.cc @@ -412,6 +412,7 @@ HttpStateData::cacheableReply() case HTTP_MULTIPLE_CHOICES: case HTTP_MOVED_PERMANENTLY: + case HTTP_PERMANENT_REDIRECT: case HTTP_GONE: /*