]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Support HTTP/0.9 in accelerator mode
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Thu, 5 Feb 2009 10:43:39 +0000 (11:43 +0100)
committerHenrik Nordstrom <henrik@henriknordstrom.net>
Thu, 5 Feb 2009 10:43:39 +0000 (11:43 +0100)
HTTP/0.9 requests do not have a HTTP header, fruitless to try to parse
a non-existing header.

Also send the right error page if header parsing fails (ERR_INVALID_REQ, not _URL)

src/client_side.cc

index e647a08137e4599daf995e4070fef20981a79cba..0563fde3856679c24a5db15f6f66c8d4c861840e 100644 (file)
@@ -2246,12 +2246,12 @@ clientProcessRequest(ConnStateData *conn, HttpParser *hp, ClientSocketContext *c
     /* compile headers */
     /* we should skip request line! */
     /* XXX should actually know the damned buffer size here */
-    if (!request->parseHeader(HttpParserHdrBuf(hp), HttpParserHdrSz(hp))) {
+    if (http_ver.major >= 1 && !request->parseHeader(HttpParserHdrBuf(hp), HttpParserHdrSz(hp))) {
         clientStreamNode *node = context->getClientReplyContext();
         debugs(33, 5, "Failed to parse request headers:\n" << HttpParserHdrBuf(hp));
         clientReplyContext *repContext = dynamic_cast<clientReplyContext *>(node->data.getRaw());
         assert (repContext);
-        repContext->setReplyToError(ERR_INVALID_URL, HTTP_BAD_REQUEST, method, http->uri, conn->peer, NULL, NULL, NULL);
+        repContext->setReplyToError(ERR_INVALID_REQ, HTTP_BAD_REQUEST, method, http->uri, conn->peer, NULL, NULL, NULL);
         assert(context->http->out.offset == 0);
         context->pullData();
         conn->flags.readMoreRequests = false;