aboutsummaryrefslogtreecommitdiffstats
path: root/WWW/Library
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2018-03-29 00:38:59 +0000
committerThomas E. Dickey <dickey@invisible-island.net>2018-03-29 00:38:59 +0000
commitac9f8d52a8715476153ade910dd81436bfdea2a7 (patch)
treef3ad7d4cdd50c3d4b5f8caf57438279c53756dc9 /WWW/Library
parentd59cf1e795c0628c2f8b4dce3052627ecdad20a8 (diff)
downloadlynx-snapshots-ac9f8d52a8715476153ade910dd81436bfdea2a7.tar.gz
snapshot of project "lynx", label v2-8-9dev_17d
Diffstat (limited to 'WWW/Library')
-rw-r--r--WWW/Library/Implementation/HTTCP.c34
-rw-r--r--WWW/Library/Implementation/HTTCP.h13
2 files changed, 32 insertions, 15 deletions
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index aad7e59c..ebcfcaef 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTTCP.c,v 1.141 2018/03/28 00:44:27 tom Exp $
+ * $LynxId: HTTCP.c,v 1.143 2018/03/28 22:29:45 tom Exp $
*
* Generic Communication Code HTTCP.c
* ==========================
@@ -32,6 +32,9 @@
#ifdef NSL_FORK
#include <signal.h>
#include <www_wait.h>
+#define FREE_NSL_FORK(p) FREE(p)
+#else
+#define FREE_NSL_FORK(p) /* nothing */
#endif /* NSL_FORK */
#ifdef HAVE_RESOLV_H
@@ -1115,7 +1118,7 @@ static void really_gethostbyname(const char *host,
* HT_ERROR Resolver error, reason not known
* HT_INTERNAL Internal error
*/
-LYNX_HOSTENT *LYGetHostByName(char *host)
+static LYNX_HOSTENT *LYGetHostByName(char *host)
{
static const char *this_func = "LYGetHostByName";
@@ -1259,6 +1262,15 @@ LYNX_HOSTENT *LYGetHostByName(char *host)
return NULL;
}
+BOOLEAN LYCheckHostByName(char *host)
+{
+ LYNX_HOSTENT *data = LYGetHostByName(host);
+ BOOLEAN result = (data != NULL);
+
+ FREE_NSL_FORK(data);
+ return result;
+}
+
/* Parse a network node address and port
* -------------------------------------
*
@@ -1393,6 +1405,7 @@ static int HTParseInet(SockA * soc_in, const char *str)
HTAlwaysAlert(host, gettext("Address length looks invalid"));
}
MemCpy((void *) &soc_in->sin_addr, phost->h_addr_list[0], phost->h_length);
+ FREE_NSL_FORK(phost);
}
#endif /* _WINDOWS_NSL */
@@ -1593,8 +1606,8 @@ static void really_getaddrinfo(const char *host,
}
#endif /* NSL_FORK */
-LYNX_ADDRINFO *HTGetAddrInfo(const char *str,
- const int defport)
+static LYNX_ADDRINFO *HTGetAddrInfo(const char *str,
+ const int defport)
{
#ifdef NSL_FORK
/* for transfer of result between from child to parent: */
@@ -1654,6 +1667,15 @@ LYNX_ADDRINFO *HTGetAddrInfo(const char *str,
#endif
return res;
}
+
+BOOLEAN HTCheckAddrInfo(const char *str, const int defport)
+{
+ LYNX_ADDRINFO *data = HTGetAddrInfo(str, defport);
+ BOOLEAN result = (data != 0);
+
+ FREE_NSL_FORK(data);
+ return result;
+}
#endif /* INET6 */
#ifdef LY_FIND_LEAKS
@@ -2181,7 +2203,9 @@ int HTDoConnect(const char *url,
#ifdef INET6
FREE(line);
-#ifndef NSL_FORK
+#ifdef NSL_FORK
+ FREE_NSL_FORK(res0);
+#else
if (res0)
freeaddrinfo(res0);
#endif
diff --git a/WWW/Library/Implementation/HTTCP.h b/WWW/Library/Implementation/HTTCP.h
index a1e83782..878053ce 100644
--- a/WWW/Library/Implementation/HTTCP.h
+++ b/WWW/Library/Implementation/HTTCP.h
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTTCP.h,v 1.24 2014/12/03 00:27:57 tom Exp $
+ * $LynxId: HTTCP.h,v 1.25 2018/03/28 21:14:18 tom Exp $
*
* /Net/dxcern/userd/timbl/hypertext/WWW/Library/src/HTTCP.html
* GENERIC TCP/IP COMMUNICATION
@@ -88,17 +88,10 @@ extern "C" {
*/
extern int lynx_nsl_status;
-#ifndef LYNX_HOSTENT
-#define LYNX_HOSTENT void
-#endif
-
- extern LYNX_HOSTENT *LYGetHostByName(char *host);
+ extern BOOLEAN LYCheckHostByName(char *host);
#ifdef INET6
-#ifndef LYNX_ADDRINFO
-#define LYNX_ADDRINFO void
-#endif
- extern LYNX_ADDRINFO *HTGetAddrInfo(const char *str, const int defport);
+ extern BOOLEAN HTCheckAddrInfo(const char *str, const int defport);
#endif
/* Get Name of This Machine