From: Amos Jeffries Date: Wed, 7 Apr 2010 12:54:15 +0000 (+1200) Subject: HTTP1.1: Advertise 1.1 on replies X-Git-Tag: SQUID_3_1_2~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=079900598714c71f1fddc032f705006f9c26d4a4;p=thirdparty%2Fsquid.git HTTP1.1: Advertise 1.1 on replies --- diff --git a/src/HttpReply.cc b/src/HttpReply.cc index 66fe3ed2a4..105135b716 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -185,7 +185,7 @@ HttpReply::make304() const /* rv->cache_control */ /* rv->content_range */ /* rv->keep_alive */ - HttpVersion ver(1,0); + HttpVersion ver(1,1); httpStatusLineSet(&rv->sline, ver, HTTP_NOT_MODIFIED, ""); for (t = 0; ImsEntries[t] != HDR_OTHER; ++t) @@ -202,7 +202,7 @@ HttpReply::packed304Reply() /* Not as efficient as skipping the header duplication, * but easier to maintain */ - HttpReply *temp = make304 (); + HttpReply *temp = make304(); MemBuf *rv = temp->pack(); delete temp; return rv; @@ -213,7 +213,7 @@ HttpReply::setHeaders(http_status status, const char *reason, const char *ctype, int64_t clen, time_t lmt, time_t expiresTime) { HttpHeader *hdr; - HttpVersion ver(1,0); + HttpVersion ver(1,1); httpStatusLineSet(&sline, ver, status, reason); hdr = &header; hdr->putStr(HDR_SERVER, visible_appname_string); @@ -248,7 +248,7 @@ void HttpReply::redirect(http_status status, const char *loc) { HttpHeader *hdr; - HttpVersion ver(1,0); + HttpVersion ver(1,1); httpStatusLineSet(&sline, ver, status, httpStatusString(status)); hdr = &header; hdr->putStr(HDR_SERVER, APP_FULLNAME); diff --git a/src/client_side.cc b/src/client_side.cc index fcf16e86d9..574976e64b 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -706,8 +706,8 @@ clientSetKeepaliveFlag(ClientHttpRequest * http) debugs(33, 3, "clientSetKeepaliveFlag: method = " << RequestMethodStr(request->method)); - /* We are HTTP/1.0 facing clients still */ - HttpVersion http_ver(1,0); + /* We are HTTP/1.1 facing clients now*/ + HttpVersion http_ver(1,1); if (httpMsgIsPersistent(http_ver, req_hdr)) request->flags.proxy_keepalive = 1; diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index 4e7243ae7d..67d0237a33 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1435,8 +1435,8 @@ clientReplyContext::cloneReply() reply = HTTPMSGLOCK(rep); if (reply->sline.protocol == PROTO_HTTP) { - /* enforce 1.0 reply version (but only on real HTTP traffic) */ - reply->sline.version = HttpVersion(1,0); + /* RFC 2616 requires us to advertise our 1.1 version (but only on real HTTP traffic) */ + reply->sline.version = HttpVersion(1,1); } /* do header conversions */ diff --git a/src/http.cc b/src/http.cc index 28fc1dafc6..4bbe5aa43e 100644 --- a/src/http.cc +++ b/src/http.cc @@ -692,7 +692,7 @@ HttpStateData::processReplyHeader() if (!parsed && error > 0) { // unrecoverable parsing error debugs(11, 3, "processReplyHeader: Non-HTTP-compliant header: '" << readBuf->content() << "'"); flags.headers_parsed = 1; - newrep->sline.version = HttpVersion(1,0); + newrep->sline.version = HttpVersion(1,1); newrep->sline.status = error; HttpReply *vrep = setVirginReply(newrep); entry->replaceHttpReply(vrep); @@ -717,7 +717,7 @@ HttpStateData::processReplyHeader() /* Skip 1xx messages for now. Advertised in Via as an internal 1.0 hop */ if (newrep->sline.protocol == PROTO_HTTP && newrep->sline.status >= 100 && newrep->sline.status < 200) { -#if WHEN_HTTP11 +#if WHEN_HTTP11_EXPECT_HANDLED /* When HTTP/1.1 check if the client is expecting a 1xx reply and maybe pass it on */ if (orig_request->header.has(HDR_EXPECT)) { // TODO: pass to the client anyway?