commit bcc6d38a2c4e57710ffd24d02cb14421050147e3
parent d3d9170975aec2963dd50556deb9d385872c36e5
Author: ukai <ukai>
Date: Wed, 6 Nov 2002 15:03:25 +0000
[w3m-dev 03382] Interrupt in no_proxy_check()
* url.c (check_no_proxy): SIGINT trap by KeyAbort
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,8 @@
+2002-11-07 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
+ * [w3m-dev 03382] Interrupt in no_proxy_check()
+ * url.c (check_no_proxy): SIGINT trap by KeyAbort
+
2002-11-06 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03380] fix configure
diff --git a/url.c b/url.c
@@ -1943,6 +1943,8 @@ int
check_no_proxy(char *domain)
{
TextListItem *tl;
+ volatile int ret = 0;
+ MySignalHandler(*volatile trap) (SIGNAL_ARG) = NULL;
if (NO_proxy_domains == NULL || NO_proxy_domains->nitem == 0 ||
domain == NULL)
@@ -1957,6 +1959,13 @@ check_no_proxy(char *domain)
/*
* to check noproxy by network addr
*/
+ if (SETJMP(AbortLoading) != 0) {
+ ret = 0;
+ goto end;
+ }
+ trap = signal(SIGINT, KeyAbort);
+ if (fmInitialized)
+ term_cbreak();
{
#ifndef INET6
struct hostent *he;
@@ -1965,8 +1974,10 @@ check_no_proxy(char *domain)
char addr[4 * 16], buf[5];
he = gethostbyname(domain);
- if (!he)
- return (0);
+ if (!he) {
+ ret = 0;
+ goto end;
+ }
for (h_addr_list = (unsigned char **)he->h_addr_list; *h_addr_list;
h_addr_list++) {
sprintf(addr, "%d", h_addr_list[0][0]);
@@ -1975,8 +1986,10 @@ check_no_proxy(char *domain)
strcat(addr, buf);
}
for (tl = NO_proxy_domains->first; tl != NULL; tl = tl->next) {
- if (strncmp(tl->ptr, addr, strlen(tl->ptr)) == 0)
- return (1);
+ if (strncmp(tl->ptr, addr, strlen(tl->ptr)) == 0) {
+ ret = 1;
+ goto end;
+ }
}
}
#else /* INET6 */
@@ -2016,7 +2029,8 @@ check_no_proxy(char *domain)
for (tl = NO_proxy_domains->first; tl != NULL; tl = tl->next) {
if (strncmp(tl->ptr, addr, strlen(tl->ptr)) == 0) {
freeaddrinfo(res0);
- return 1;
+ ret = 1;
+ goto end;
}
}
}
@@ -2027,7 +2041,11 @@ check_no_proxy(char *domain)
}
#endif /* INET6 */
}
- return 0;
+ end:
+ if (fmInitialized)
+ term_raw();
+ signal(SIGINT, trap);
+ return ret;
}
char *