[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>
This commit is contained in:
Fumitoshi UKAI
2002-11-06 15:03:25 +00:00
parent fcf7c4af06
commit bcb1de20e2
2 changed files with 31 additions and 8 deletions

View File

@@ -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
@@ -4360,4 +4365,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1
* import w3m-0.2.1
$Id: ChangeLog,v 1.481 2002/11/06 14:58:02 ukai Exp $
$Id: ChangeLog,v 1.482 2002/11/06 15:03:25 ukai Exp $

32
url.c
View File

@@ -1,4 +1,4 @@
/* $Id: url.c,v 1.54 2002/11/04 08:47:38 ukai Exp $ */
/* $Id: url.c,v 1.55 2002/11/06 15:03:26 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include <sys/socket.h>
@@ -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 *