]> sjero.net Git - wget/commitdiff
Use persistent connections with proxies supporting them.
authorGiuseppe Scrivano <gscrivano@gnu.org>
Mon, 9 Aug 2010 10:56:49 +0000 (12:56 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Mon, 9 Aug 2010 10:56:49 +0000 (12:56 +0200)
src/ChangeLog
src/http.c

index 559589f7c73bc54441559e5d46fdcbbe0c3e4668..f9e1d552f379610637dd89f76a4b9ca203c45874 100644 (file)
@@ -1,8 +1,12 @@
 2010-08-09  Giuseppe Scrivano  <gscrivano@gnu.org>
 
+       Fix a problem with HTTP/1.0 proxies.
        * http.c (gethttp): Specify the connection header when keep alive
        connections are not used.
 
+       Use persistent connections with proxies supporting them.
+       * http.c (gethttp): Specify Proxy-Connection to the HTTP proxy.
+
 2010-08-06  Giuseppe Scrivano  <gscrivano@gnu.org>
 
        * css-url.c (get_uri_string): Skip empty urls.
index 7b27ae67b7439b0aa588e43a14fa7349e00617da..496e64a73dc5f976c3507a4c60eef6bcaac86fe9 100644 (file)
@@ -1573,15 +1573,9 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
   /* Is the server using the chunked transfer encoding?  */
   bool chunked_transfer_encoding = false;
 
-  /* Whether keep-alive should be inhibited.
-
-     RFC 2068 requests that 1.0 clients not send keep-alive requests
-     to proxies.  This is because many 1.0 proxies do not interpret
-     the Connection header and transfer it to the remote server,
-     causing it to not close the connection and leave both the proxy
-     and the client hanging.  */
+  /* Whether keep-alive should be inhibited.  */
   bool inhibit_keep_alive =
-    !opt.http_keep_alive || opt.ignore_length || proxy != NULL;
+    !opt.http_keep_alive || opt.ignore_length;
 
   /* Headers sent when using POST. */
   wgint post_data_size = 0;
@@ -1694,7 +1688,15 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
   if (inhibit_keep_alive)
     request_set_header (req, "Connection", "Close", rel_none);
   else
-    request_set_header (req, "Connection", "Keep-Alive", rel_none);
+    {
+      if (proxy == NULL)
+        request_set_header (req, "Connection", "Keep-Alive", rel_none);
+      else
+        {
+          request_set_header (req, "Connection", "Close", rel_none);
+          request_set_header (req, "Proxy-Connection", "Keep-Alive", rel_none);
+        }
+    }
 
   if (opt.post_data || opt.post_file_name)
     {