]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Compliance: reply with 400 (Bad Request) if request header is too big.
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 31 Aug 2010 23:34:10 +0000 (17:34 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 31 Aug 2010 23:34:10 +0000 (17:34 -0600)
Reply with a standard 400 (Bad Request) instead of 601 (Unknown) status in
case of an ERR_TOO_BIG error. HTTP does not have a dedicated code for the
too-big header error. There is 414 (Request-URI Too Long), but Squid does not
distinguish too-large headers from too-large URIs.

Co-Advisor test case: test_case/rfc2616/longUri-65536

src/HttpStatusCode.h
src/client_side.cc

index 46c5d8179dbc46f7b3946e6d1f1b34a8858317cd..16c4b91a23225fdd08bb344c7dd95e4e9d26241c 100644 (file)
@@ -52,6 +52,10 @@ typedef enum {
     HTTP_GATEWAY_TIMEOUT = 504,
     HTTP_HTTP_VERSION_NOT_SUPPORTED = 505,
     HTTP_INSUFFICIENT_STORAGE = 507,    /**< RFC2518 section 10.6 */
+
+    // The 6xx codes below are for internal use only: Bad requests result
+    // in HTTP_BAD_REQUEST; bad responses in HTTP_GATEWAY_TIMEOUT.
+
     HTTP_INVALID_HEADER = 600,          /**< Squid header parsing error */
     HTTP_HEADER_TOO_LARGE = 601         /* Header too large to process */
 } http_status;
index ee33f79ceeb5962e35a1117a970f307be247d773..1644d5b1bb5608f97f487699cdc7db88646a3a2b 100644 (file)
@@ -2407,7 +2407,7 @@ clientProcessRequest(ConnStateData *conn, HttpParser *hp, ClientSocketContext *c
         assert (repContext);
         switch (hp->request_parse_status) {
         case HTTP_HEADER_TOO_LARGE:
-            repContext->setReplyToError(ERR_TOO_BIG, HTTP_HEADER_TOO_LARGE, method, http->uri, conn->peer, NULL, conn->in.buf, NULL);
+            repContext->setReplyToError(ERR_TOO_BIG, HTTP_BAD_REQUEST, method, http->uri, conn->peer, NULL, conn->in.buf, NULL);
             break;
         case HTTP_METHOD_NOT_ALLOWED:
             repContext->setReplyToError(ERR_UNSUP_REQ, HTTP_METHOD_NOT_ALLOWED, method, http->uri, conn->peer, NULL, conn->in.buf, NULL);