]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Register status 308 permanent redirect
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 21 May 2012 02:35:41 +0000 (20:35 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 21 May 2012 02:35:41 +0000 (20:35 -0600)
* relay "Permanent Redirect" message on status line
* MAY cache these responses with heuristics
* accept this status as a redirect status from URL redirectors

src/HttpStatusCode.h
src/HttpStatusLine.cc
src/client_side_request.cc
src/http.cc

index 16c4b91a23225fdd08bb344c7dd95e4e9d26241c..7ce73526b8a59fb9d5037bfa40b078c22b72f78d 100644 (file)
@@ -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,
index 5b36b08df58fe87a3ae1c91074f09907303954f2..67dc2f3cfc5e2df4a161aedcbdc79c2dd1f00b3a 100644 (file)
@@ -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;
index be2f3e88287b4746062adfcb0c5d9ed13cd8001e..c0848397aff5e7a6316f6da3493f21debb161edb 100644 (file)
@@ -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.
index 63f78bac35fc5e354348fd9c604f29a8259f55cf..edd96bb091ac0212120529fe6aec12b0661f475d 100644 (file)
@@ -412,6 +412,7 @@ HttpStateData::cacheableReply()
     case HTTP_MULTIPLE_CHOICES:
 
     case HTTP_MOVED_PERMANENTLY:
+    case HTTP_PERMANENT_REDIRECT:
 
     case HTTP_GONE:
         /*