From 7488d701bf861852568dd12106d9376234bbe2bc Mon Sep 17 00:00:00 2001 From: hniksic Date: Tue, 30 Mar 2004 15:19:16 -0800 Subject: [PATCH] [svn] Send the Proxy-Authorization header over non-SSL connections too. --- src/ChangeLog | 5 ++++ src/http.c | 64 ++++++++++++++++++++++++++++----------------------- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9b90176c..e7a69261 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-03-30 Hrvoje Niksic + + * http.c (gethttp): Send the Proxy-Authorization header over + non-SSL connections too. + 2004-03-25 David Fritz * mswindows.c (fake_fork_child): Ignore error code when diff --git a/src/http.c b/src/http.c index dec5f026..dfb7c002 100644 --- a/src/http.c +++ b/src/http.c @@ -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_SSL) +#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 -- 2.39.2