From: Amos Jeffries Date: Wed, 7 Apr 2010 06:22:41 +0000 (+1200) Subject: HTTP1.1: Advertise 1.1 on replies X-Git-Tag: SQUID_3_2_0_1~314 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=871c031f4531c57417a6f67df0b4aad279544679;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 d866b59e55..a1075ec3f3 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -716,8 +716,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 a6580eb29e..9156fb218a 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1443,8 +1443,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 d093aee47e..23ae05ce3b 100644 --- a/src/http.cc +++ b/src/http.cc @@ -689,7 +689,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); @@ -714,7 +714,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?