commit d0b5103ab3cd85fe53e9b5476af2b956aa5e2f57
parent 8bbfc5b837a45e8b0b6696806175503e218ab91b
Author: ukai <ukai>
Date: Thu, 14 Nov 2002 16:56:22 +0000
[w3m-dev 03429] https proxy
* fm.h (HTTPS_proxy): added
(HTTPS_proxy_parsed): added
* main.c (main): check https_proxy
* rc.c (CMT_HTTPS_PROXY): added
(https_proxy): added
(parse_proxy): HTTPS_proxy
* url.c (openURL): for HTTPS, use HTTPS_proxy
(schemeToProxy): HTTPS_proxy_parsed
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
5 files changed, 58 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,15 @@
+2002-11-15 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
+ * [w3m-dev 03429] https proxy
+ * fm.h (HTTPS_proxy): added
+ (HTTPS_proxy_parsed): added
+ * main.c (main): check https_proxy
+ * rc.c (CMT_HTTPS_PROXY): added
+ (https_proxy): added
+ (parse_proxy): HTTPS_proxy
+ * url.c (openURL): for HTTPS, use HTTPS_proxy
+ (schemeToProxy): HTTPS_proxy_parsed
+
2002-11-14 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03428] install manual as w3m.exe.1 on Cygwin
diff --git a/fm.h b/fm.h
@@ -745,11 +745,17 @@ extern unsigned char PcKeymap[];
extern FuncList w3mFuncList[];
global char *HTTP_proxy init(NULL);
+#ifdef USE_SSL
+global char *HTTPS_proxy init(NULL);
+#endif /* USE_SSL */
#ifdef USE_GOPHER
global char *GOPHER_proxy init(NULL);
#endif /* USE_GOPHER */
global char *FTP_proxy init(NULL);
global ParsedURL HTTP_proxy_parsed;
+#ifdef USE_SSL
+global ParsedURL HTTPS_proxy_parsed;
+#endif /* USE_SSL */
#ifdef USE_GOPHER
global ParsedURL GOPHER_proxy_parsed;
#endif /* USE_GOPHER */
diff --git a/main.c b/main.c
@@ -417,6 +417,14 @@ main(int argc, char **argv, char **envp)
((p = getenv("HTTP_PROXY")) ||
(p = getenv("http_proxy")) || (p = getenv("HTTP_proxy"))))
HTTP_proxy = p;
+#ifdef USE_SSL
+ if (!non_null(HTTPS_proxy) &&
+ ((p = getenv("HTTPS_PROXY")) ||
+ (p = getenv("https_proxy")) || (p = getenv("HTTPS_proxy"))))
+ HTTPS_proxy = p;
+ if (HTTPS_proxy == NULL && non_null(HTTP_proxy))
+ HTTPS_proxy = HTTP_proxy;
+#endif /* USE_SSL */
#ifdef USE_GOPHER
if (!non_null(GOPHER_proxy) &&
((p = getenv("GOPHER_PROXY")) ||
diff --git a/rc.c b/rc.c
@@ -91,6 +91,9 @@ static char *config_file = NULL;
#define CMT_VISITED_ANCHOR "訪れたことがあるリンクは色を変える"
#define CMT_V_COLOR "訪れたことがあるリンクの色"
#define CMT_HTTP_PROXY "HTTPプロキシ(URLで入力)"
+#ifdef USE_SSL
+#define CMT_HTTPS_PROXY "HTTPSプロキシ(URLで入力)"
+#endif /* USE_SSL */
#ifdef USE_GOPHER
#define CMT_GOPHER_PROXY "GOPHERプロキシ(URLで入力)"
#endif /* USE_GOPHER */
@@ -240,6 +243,9 @@ static char *config_file = NULL;
#define CMT_BG_COLOR "Color of background"
#define CMT_MARK_COLOR "Color of mark"
#define CMT_HTTP_PROXY "URL of HTTP proxy host"
+#ifdef USE_SSL
+#define CMT_HTTPS_PROXY "URL of HTTPS proxy host"
+#endif /* USE_SSL */
#ifdef USE_GOPHER
#define CMT_GOPHER_PROXY "URL of GOPHER proxy host"
#endif /* USE_GOPHER */
@@ -630,6 +636,10 @@ struct param_ptr params3[] = {
struct param_ptr params4[] = {
{"http_proxy", P_STRING, PI_TEXT, (void *)&HTTP_proxy, CMT_HTTP_PROXY,
NULL},
+#ifdef USE_SSL
+ {"https_proxy", P_STRING, PI_TEXT, (void *)&HTTPS_proxy, CMT_HTTPS_PROXY,
+ NULL},
+#endif /* USE_SSL */
#ifdef USE_GOPHER
{"gopher_proxy", P_STRING, PI_TEXT, (void *)&GOPHER_proxy,
CMT_GOPHER_PROXY, NULL},
@@ -1220,6 +1230,10 @@ parse_proxy()
{
if (non_null(HTTP_proxy))
parseURL(HTTP_proxy, &HTTP_proxy_parsed, NULL);
+#ifdef USE_SSL
+ if (non_null(HTTPS_proxy))
+ parseURL(HTTPS_proxy, &HTTPS_proxy_parsed, NULL);
+#endif /* USE_SSL */
#ifdef USE_GOPHER
if (non_null(GOPHER_proxy))
parseURL(GOPHER_proxy, &GOPHER_proxy_parsed, NULL);
diff --git a/url.c b/url.c
@@ -1600,8 +1600,11 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current,
hr->command = HR_COMMAND_POST;
if (request && request->method == FORM_METHOD_HEAD)
hr->command = HR_COMMAND_HEAD;
- if (non_null(HTTP_proxy) &&
- !Do_not_use_proxy &&
+ if ((
+#ifdef USE_SSL
+ (pu->scheme == SCM_HTTPS) ? non_null(HTTPS_proxy) :
+#endif /* USE_SSL */
+ non_null(HTTP_proxy)) && !Do_not_use_proxy &&
pu->host != NULL && !check_no_proxy(pu->host)) {
char *save_label;
hr->flag |= HR_FLAG_PROXY;
@@ -1614,17 +1617,21 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current,
return uf;
}
}
+ else if (pu->scheme == SCM_HTTPS) {
+ sock = openSocket(HTTPS_proxy_parsed.host,
+ schemetable[HTTPS_proxy_parsed.scheme].
+ cmdname, HTTPS_proxy_parsed.port);
+ sslh = NULL;
+ }
else {
+#endif /* USE_SSL */
sock = openSocket(HTTP_proxy_parsed.host,
schemetable[HTTP_proxy_parsed.scheme].
cmdname, HTTP_proxy_parsed.port);
+#ifdef USE_SSL
sslh = NULL;
}
-#else
- sock = openSocket(HTTP_proxy_parsed.host,
- schemetable[HTTP_proxy_parsed.scheme].cmdname,
- HTTP_proxy_parsed.port);
-#endif
+#endif /* USE_SSL */
if (sock < 0) {
#ifdef SOCK_DEBUG
sock_log("Can't open socket\n");
@@ -2229,11 +2236,13 @@ schemeToProxy(int scheme)
ParsedURL *pu = NULL; /* for gcc */
switch (scheme) {
case SCM_HTTP:
+ pu = &HTTP_proxy_parsed;
+ break;
#ifdef USE_SSL
case SCM_HTTPS:
-#endif
- pu = &HTTP_proxy_parsed;
+ pu = &HTTPS_proxy_parsed;
break;
+#endif
case SCM_FTP:
pu = &FTP_proxy_parsed;
break;