]> sjero.net Git - wget/blobdiff - src/http.c
[svn] Fix typo.
[wget] / src / http.c
index b779e36ee6f71d82318c8e5ba7e9780bcbbbf5c5..0f19cbb778a310d738b4708c0ffee936b123aa87 100644 (file)
@@ -1057,7 +1057,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
   int keep_alive;
 
   /* Whether keep-alive should be inhibited. */
-  int inhibit_keep_alive = !opt.http_keep_alive;
+  int inhibit_keep_alive = !opt.http_keep_alive || opt.ignore_length;
 
   /* Headers sent when using POST. */
   long post_data_size = 0;
@@ -1113,35 +1113,6 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
 
   conn = u;
 
-  proxyauth = NULL;
-  if (proxy)
-    {
-      char *proxy_user, *proxy_passwd;
-      /* For normal username and password, URL components override
-        command-line/wgetrc parameters.  With proxy
-        authentication, it's the reverse, because proxy URLs are
-        normally the "permanent" ones, so command-line args
-        should take precedence.  */
-      if (opt.proxy_user && opt.proxy_passwd)
-       {
-         proxy_user = opt.proxy_user;
-         proxy_passwd = opt.proxy_passwd;
-       }
-      else
-       {
-         proxy_user = proxy->user;
-         proxy_passwd = proxy->passwd;
-       }
-      /* #### This does not appear right.  Can't the proxy request,
-        say, `Digest' authentication?  */
-      if (proxy_user && proxy_passwd)
-       proxyauth = basic_authentication_encode (proxy_user, proxy_passwd);
-
-      /* If we're using a proxy, we will be connecting to the proxy
-        server.  */
-      conn = proxy;
-    }
-
   /* Prepare the request to send. */
 
   req = request_new ();
@@ -1205,6 +1176,41 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
                          rel_value);
     }
 
+  proxyauth = NULL;
+  if (proxy)
+    {
+      char *proxy_user, *proxy_passwd;
+      /* For normal username and password, URL components override
+        command-line/wgetrc parameters.  With proxy
+        authentication, it's the reverse, because proxy URLs are
+        normally the "permanent" ones, so command-line args
+        should take precedence.  */
+      if (opt.proxy_user && opt.proxy_passwd)
+       {
+         proxy_user = opt.proxy_user;
+         proxy_passwd = opt.proxy_passwd;
+       }
+      else
+       {
+         proxy_user = proxy->user;
+         proxy_passwd = proxy->passwd;
+       }
+      /* #### This does not appear right.  Can't the proxy request,
+        say, `Digest' authentication?  */
+      if (proxy_user && proxy_passwd)
+       proxyauth = basic_authentication_encode (proxy_user, proxy_passwd);
+
+      /* If we're using a proxy, we will be connecting to the proxy
+        server.  */
+      conn = proxy;
+
+      /* Proxy authorization over SSL is handled below. */
+#ifdef HAVE_SSL
+      if (u->scheme != SCHEME_HTTPS)
+#endif
+       request_set_header (req, "Proxy-Authorization", proxyauth, rel_value);
+    }
+
   {
     /* Whether we need to print the host header with braces around
        host, e.g. "Host: [3ffe:8100:200:2::2]:1234" instead of the
@@ -1455,7 +1461,8 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
       print_server_response (resp, "  ");
     }
 
-  if (response_header_copy (resp, "Content-Length", hdrval, sizeof (hdrval)))
+  if (!opt.ignore_length
+      && response_header_copy (resp, "Content-Length", hdrval, sizeof (hdrval)))
     contlen = strtol (hdrval, NULL, 10);
 
   /* Check for keep-alive related responses. */
@@ -1911,7 +1918,7 @@ File `%s' already there, will not retrieve.\n"), *hstat.local_file);
          logprintf (LOG_VERBOSE, "--%s--  %s\n  %s => `%s'\n",
                     tms, hurl, tmp, locf);
 #ifdef WINDOWS
-         ws_changetitle (hurl, 1);
+         ws_changetitle (hurl);
 #endif
          xfree (hurl);
        }