From: hno <> Date: Mon, 18 Jun 2007 03:48:20 +0000 (+0000) Subject: Author: Christos Tsantilas X-Git-Tag: SQUID_3_0_PRE7~218 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=793c0ba98e7ea1d7dbc34c11f06b096336eda7b9;p=thirdparty%2Fsquid.git Author: Christos Tsantilas HTTP/0.9 responses support This patch adds back HTTP/0.9 support, upgrading them to HTTP/1.0. --- diff --git a/src/http.cc b/src/http.cc index 2dc02bcb07..a674aa1a4d 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.523 2007/05/29 13:31:40 amosjeffries Exp $ + * $Id: http.cc,v 1.524 2007/06/17 21:48:20 hno Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -717,30 +717,42 @@ HttpStateData::processReplyHeader() const bool parsed = newrep->parse(readBuf, eof, &error); - if (!parsed && error > 0) { // unrecoverable parsing error - debugs(11, 3, "processReplyHeader: Non-HTTP-compliant header: '" << readBuf->content() << "'"); - flags.headers_parsed = 1; - // negated result yields http_status - failReply (newrep, error); - ctx_exit(ctx); - return; + if(!parsed && readBuf->contentSize() > 5 && strncmp(readBuf->content(), "HTTP/", 5) != 0){ + MemBuf *mb; + HttpReply *tmprep = new HttpReply; + tmprep->sline.version = HttpVersion(1, 0); + tmprep->sline.status = HTTP_OK; + tmprep->header.putTime(HDR_DATE, squid_curtime); + tmprep->header.putExt("X-Transformed-From", "HTTP/0.9"); + mb = tmprep->pack(); + newrep->parse(mb, eof, &error); + delete tmprep; } - - if (!parsed) { // need more data - assert(!error); - assert(!eof); - delete newrep; - ctx_exit(ctx); - return; + else{ + if (!parsed && error > 0) { // unrecoverable parsing error + debugs(11, 3, "processReplyHeader: Non-HTTP-compliant header: '" << readBuf->content() << "'"); + flags.headers_parsed = 1; + // negated result yields http_status + failReply (newrep, error); + ctx_exit(ctx); + return; + } + + if (!parsed) { // need more data + assert(!error); + assert(!eof); + delete newrep; + ctx_exit(ctx); + return; + } + + debugs(11, 9, "GOT HTTP REPLY HDR:\n---------\n" << readBuf->content() << "\n----------"); + + header_bytes_read = headersEnd(readBuf->content(), readBuf->contentSize()); + readBuf->consume(header_bytes_read); } reply = HTTPMSGLOCK(newrep); - - debugs(11, 9, "GOT HTTP REPLY HDR:\n---------\n" << readBuf->content() << "\n----------"); - - header_bytes_read = headersEnd(readBuf->content(), readBuf->contentSize()); - readBuf->consume(header_bytes_read); - flags.headers_parsed = 1; keepaliveAccounting(reply);