diff options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | file.c | 8 | ||||
-rw-r--r-- | fm.h | 3 | ||||
-rw-r--r-- | html.c | 6 | ||||
-rw-r--r-- | main.c | 6 | ||||
-rw-r--r-- | url.c | 18 |
6 files changed, 42 insertions, 15 deletions
@@ -1,3 +1,17 @@ +2002-03-01 Fumitoshi UKAI <ukai@debian.or.jp> + + * [w3m-dev 03072] Proxy-Authorization (Re: Re: https through proxy) + * file.c (loadGeneralFile) delete Proxy-Authorization set here + * fm.h (HR_FLAG_PROXY): added + * main.c (MAIN): need "Basic " for proxy_auth_cookie + * url.c (HTTPrequest): add seen_proxy_auth + if proxy and no Proxy-Authorization: header seen and + has proxy_auth_cookie, use it + * url.c (openURL): hr->flag |= HR_FLAG_PROXY + + * file.c (loadGeneralFile) comment indent fix + * html.c (TagMAP): ditto + 2002-02-28 Fumitoshi UKAI <ukai@debian.or.jp> * [w3m-dev 03070] Re: https through proxy @@ -3006,4 +3020,4 @@ * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.327 2002/02/27 16:53:27 ukai Exp $ +$Id: ChangeLog,v 1.328 2002/02/28 16:15:41 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.71 2002/02/26 04:08:48 ukai Exp $ */ +/* $Id: file.c,v 1.72 2002/02/28 16:15:41 ukai Exp $ */ #include "fm.h" #include <sys/types.h> #include "myctype.h" @@ -1433,10 +1433,6 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, prevtrap = NULL; add_auth_cookie_flag = 0; - if (proxy_auth_cookie != NULL) { - pushText(extra_header, Sprintf("Proxy-Authorization: Basic %s\r\n", - proxy_auth_cookie->ptr)->ptr); - } load_doc: url_option.referer = referer; url_option.flag = flag; @@ -1566,7 +1562,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, } if (t_buf == NULL) t_buf = newBuffer(INIT_BUFFER_WIDTH); -#if 0 /* USE_SSL */ +#if 0 /* USE_SSL */ if (IStype(f.stream) == IST_SSL) { Str s = ssl_get_certificate(f.stream, pu.host); if (s == NULL) @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.52 2002/02/19 15:50:18 ukai Exp $ */ +/* $Id: fm.h,v 1.53 2002/02/28 16:15:41 ukai Exp $ */ /* * w3m: WWW wo Miru utility * @@ -675,6 +675,7 @@ typedef struct http_request { #define HR_COMMAND_HEAD 3 #define HR_FLAG_LOCAL 1 +#define HR_FLAG_PROXY 2 #define HTST_UNKNOWN 255 #define HTST_MISSING 254 @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.11 2002/02/25 15:55:39 ukai Exp $ */ +/* $Id: html.c,v 1.12 2002/02/28 16:15:41 ukai Exp $ */ #include "html.h" /* Define HTML Tag Infomation Table */ @@ -134,8 +134,8 @@ TagInfo TagMAP[MAX_HTMLTAG] = { {"hr", ALST_HR, MAXA_HR, 0}, /* 16 HTML_HR */ {"dl", ALST_DL, MAXA_DL, 0}, /* 17 HTML_DL */ {"/dl", NULL, 0, TFLG_END}, /* 18 HTML_N_DL */ - {"dt", ALST_NOP, MAXA_NOP, 0}, /* 19 HTML_DT */ - {"dd", ALST_NOP, MAXA_NOP, 0}, /* 20 HTML_DD */ + {"dt", ALST_NOP, MAXA_NOP, 0}, /* 19 HTML_DT */ + {"dd", ALST_NOP, MAXA_NOP, 0}, /* 20 HTML_DD */ {"pre", ALST_PRE, MAXA_PRE, 0}, /* 21 HTML_PRE */ {"/pre", NULL, 0, TFLG_END}, /* 22 HTML_N_PRE */ {"blockquote", ALST_NOP, MAXA_NOP, 0}, /* 23 HTML_BLQ */ @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.84 2002/02/19 15:25:19 ukai Exp $ */ +/* $Id: main.c,v 1.85 2002/02/28 16:15:41 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -643,7 +643,9 @@ MAIN(int argc, char **argv, char **envp) else if (!strcmp("-pauth", argv[i])) { if (++i >= argc) usage(); - proxy_auth_cookie = encodeB(argv[i]); + proxy_auth_cookie = Strnew_m_charp("Basic ", + encodeB(argv[i])->ptr, + NULL); while (argv[i][0]) { argv[i][0] = '\0'; argv[i]++; @@ -1,4 +1,4 @@ -/* $Id: url.c,v 1.45 2002/02/27 16:53:27 ukai Exp $ */ +/* $Id: url.c,v 1.46 2002/02/28 16:15:42 ukai Exp $ */ #include <stdio.h> #include "config.h" #include "fm.h" @@ -1284,6 +1284,7 @@ HTTPrequest(ParsedURL *pu, ParsedURL *current, HRequest *hr, TextList *extra) { Str tmp; TextListItem *i; + int seen_proxy_auth = 0; #ifdef USE_COOKIE Str cookie; #endif /* USE_COOKIE */ @@ -1296,8 +1297,18 @@ HTTPrequest(ParsedURL *pu, ParsedURL *current, HRequest *hr, TextList *extra) else Strcat_charp(tmp, otherinfo(pu, current, hr->referer)); if (extra != NULL) - for (i = extra->first; i != NULL; i = i->next) + for (i = extra->first; i != NULL; i = i->next) { + if (strncasecmp(i->ptr, "Proxy-Authorization:", + sizeof("Proxy-Authorization:") - 1) == 0) + seen_proxy_auth = 1; Strcat_charp(tmp, i->ptr); + } + + if (!seen_proxy_auth && (hr->flag & HR_FLAG_PROXY) + && proxy_auth_cookie != NULL) + Strcat_m_charp(tmp, "Proxy-Authorization: ", proxy_auth_cookie->ptr, + "\r\n", NULL); + #ifdef USE_COOKIE if (hr->command != HR_COMMAND_CONNECT && use_cookie && (cookie = find_cookie(pu))) { @@ -1516,6 +1527,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, if (non_null(FTP_proxy) && !Do_not_use_proxy && pu->host != NULL && !check_no_proxy(pu->host)) { + hr->flag |= HR_FLAG_PROXY; sock = openSocket(FTP_proxy_parsed.host, schemetable[FTP_proxy_parsed.scheme].cmdname, FTP_proxy_parsed.port); @@ -1546,6 +1558,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, !Do_not_use_proxy && pu->host != NULL && !check_no_proxy(pu->host)) { char *save_label; + hr->flag |= HR_FLAG_PROXY; #ifdef USE_SSL if (pu->scheme == SCM_HTTPS && *status == HTST_CONNECT) { sock = ssl_socket_of(ouf->stream); @@ -1650,6 +1663,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, if (non_null(GOPHER_proxy) && !Do_not_use_proxy && pu->host != NULL && !check_no_proxy(pu->host)) { + hr->flag |= HR_FLAG_PROXY; sock = openSocket(GOPHER_proxy_parsed.host, schemetable[GOPHER_proxy_parsed.scheme].cmdname, GOPHER_proxy_parsed.port); |