]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Additional 308 status handling
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 11 Apr 2012 09:10:15 +0000 (03:10 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 11 Apr 2012 09:10:15 +0000 (03:10 -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/HttpStatusLine.cc
src/client_side_request.cc
src/http.cc

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 ca38f2f5a43255323a958341424c10407d837d17..9f9285166f25bc24fa3b47802af8299931f1fd15 100644 (file)
@@ -1211,6 +1211,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;
 
@@ -1219,10 +1220,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:
         /*