]> sjero.net Git - wget/commitdiff
[svn] Fix request-line argument when talking to SSL server over proxy.
authorhniksic <devnull@localhost>
Fri, 6 May 2005 23:27:47 +0000 (16:27 -0700)
committerhniksic <devnull@localhost>
Fri, 6 May 2005 23:27:47 +0000 (16:27 -0700)
src/ChangeLog
src/http.c

index 2d3ed991d90f5a09e9c57c3e6e6218baee455df8..17d53ff603be9f0174592e3b59cda521ffa4a715 100644 (file)
@@ -1,3 +1,12 @@
+2005-05-07  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * http.c (gethttp): When tunnelling SSL traffic over proxy with
+       CONNECT, we're really talking to the remote server directly.
+       Because of this, the request-line argument must be the URL path
+       rather than the whole URL, as it would be when using regular
+       proxies.
+       Reported by Charles Lane.
+
 2005-05-06  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * init.c (cmd_spec_useragent): Allow empty User-Agent.
index d046eaea5f65261f5d302dc4790a181fcf986b5c..33482a2a2455a0c276568e32e859820bc35b8f28 100644 (file)
@@ -1216,6 +1216,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
 
   req = request_new ();
   {
+    char *meth_arg;
     const char *meth = "GET";
     if (*dt & HEAD_ONLY)
       meth = "HEAD";
@@ -1224,8 +1225,18 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
     /* Use the full path, i.e. one that includes the leading slash and
        the query string.  E.g. if u->path is "foo/bar" and u->query is
        "param=value", full_path will be "/foo/bar?param=value".  */
-    request_set_method (req, meth,
-                       proxy ? xstrdup (u->url) : url_full_path (u));
+    if (proxy
+#ifdef HAVE_SSL
+       /* When using SSL over proxy, CONNECT establishes a direct
+          connection to the HTTPS server.  Therefore use the same
+          argument as when talking to the server directly. */
+       && u->scheme != SCHEME_HTTPS
+#endif
+       )
+      meth_arg = xstrdup (u->url);
+    else
+      meth_arg = url_full_path (u);
+    request_set_method (req, meth, meth_arg);
   }
 
   request_set_header (req, "Referer", (char *) hs->referer, rel_none);