]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
HTTP1.1: Advertise 1.1 on replies
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 7 Apr 2010 12:54:15 +0000 (00:54 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 7 Apr 2010 12:54:15 +0000 (00:54 +1200)
src/HttpReply.cc
src/client_side.cc
src/client_side_reply.cc
src/http.cc

index 66fe3ed2a43dc64649caf2ddb7d43905f3b67f3e..105135b716ba0eb3c6cc6d2c203ff4b3e7ee6263 100644 (file)
@@ -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);
index fcf16e86d94114fa716d1c54af0320f78555f97d..574976e64bfa806ed31d02645188b199b413a241 100644 (file)
@@ -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;
index 4e7243ae7dc82dda5999ad9ba66cf6c17f47e495..67d0237a3303ff68f301b9da341829f0cc4511ed 100644 (file)
@@ -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 */
index 28fc1dafc659ec1a20aa9a4c30ebd5e5d80ae781..4bbe5aa43ef87df9e1890cd1fd8ffbe98e0e2954 100644 (file)
@@ -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?