about summary refs log tree commit diff stats
path: root/WWW
diff options
context:
space:
mode:
Diffstat (limited to 'WWW')
-rw-r--r--WWW/Library/Implementation/HTFWriter.c4
-rw-r--r--WWW/Library/Implementation/HTTCP.c70
-rw-r--r--WWW/Library/Implementation/tcp.h3
3 files changed, 40 insertions, 37 deletions
diff --git a/WWW/Library/Implementation/HTFWriter.c b/WWW/Library/Implementation/HTFWriter.c
index 8bccb379..435fd3e8 100644
--- a/WWW/Library/Implementation/HTFWriter.c
+++ b/WWW/Library/Implementation/HTFWriter.c
@@ -248,7 +248,7 @@ PUBLIC HTStream* HTSaveAndExecute ARGS3(
     
     /* Save the file under a suitably suffixed name */
     
-    suffix = HTFileSuffix(pres->rep);
+    suffix = HTFileSuffix(pres->rep, anchor->content_encoding);
 
     fnam = (char *)malloc (L_tmpnam + 16 + strlen(suffix));
     tmpnam (fnam);
@@ -326,7 +326,7 @@ PUBLIC HTStream* HTSaveLocally ARGS3(
     
     /* Save the file under a suitably suffixed name */
     
-    suffix = HTFileSuffix(pres->rep);
+    suffix = HTFileSuffix(pres->rep, anchor->content_encoding);
 
     fnam = (char *)malloc (L_tmpnam + 16 + strlen(suffix));
     tmpnam (fnam);
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index e94f4f2f..ba4a4b0f 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -449,13 +449,11 @@ PUBLIC int HTParseInet ARGS2(
 	    **	control variables.
 	    */
 	    pid_t fpid, waitret;
-	    int pfd[2], cstat, cst1 = 0, cycle = 0;
+	    int pfd[2], h_length, selret, readret, waitstat = 0, cycle = 0;
 	    fd_set readfds;
 	    struct timeval timeout;
 	    int dns_patience = 30; /* how many seconds will we wait for DNS? */
-#ifdef WNOWAIT
 	    int child_exited = 0;
-#endif
 
 	    /*
 	    **  Reap any children that have terminated since last time
@@ -496,12 +494,12 @@ PUBLIC int HTParseInet ARGS2(
 		**  native int).
 		*/
 		if (OK_HOST(phost))
-			cstat = phost->h_length;
+			h_length = phost->h_length;
 		else
-			cstat = 0;
-		write(pfd[1], &cstat, sizeof cstat);
+			h_length = 0;
+		write(pfd[1], &h_length, sizeof h_length);
 
-		if (cstat) {
+		if (h_length) {
 		    /*
 		    **  Return value through pipe...
 		    */
@@ -549,54 +547,56 @@ PUBLIC int HTParseInet ARGS2(
 		*/
 #ifdef SOCKS
 		if (socks_flag)
-		    cst1 = Rselect(pfd[0] + 1, (void *)&readfds, NULL, NULL, &timeout);
+		    selret = Rselect(pfd[0] + 1, (void *)&readfds, NULL, NULL, &timeout);
 		else
 #endif /* SOCKS */
-		    cst1 = select(pfd[0] + 1, (void *)&readfds, NULL, NULL, &timeout);
+		    selret = select(pfd[0] + 1, (void *)&readfds, NULL, NULL, &timeout);
 
-		if ((cst1 > 0) && FD_ISSET(pfd[0], &readfds)) {
+		if ((selret > 0) && FD_ISSET(pfd[0], &readfds)) {
 		    /*
 		    **	First get length of address.  -BL
 		    */
-		    cst1 = read(pfd[0], (void *)&cstat, sizeof cstat);
-		    if (cstat == sizeof soc_in->sin_addr) {
+		    readret = read(pfd[0], (void *)&h_length, sizeof h_length);
+		    if (readret == sizeof h_length &&
+			h_length == sizeof soc_in->sin_addr) {
 			/*
 			**  Then get address itself.  -BL
 			*/
-			cst1 = read(pfd[0], (void *)&soc_in->sin_addr, cstat);
-			if (cst1 == cstat) success = 1;
+			readret = read(pfd[0], (void *)&soc_in->sin_addr, h_length);
+			if (readret == h_length) success = 1;
 	    	    }
 		    /*
 		    **  Make sure child is cleaned up.  -BL
 		    */
-		    waitret = waitpid(fpid, &cst1, WNOHANG);
-		    if (!WIFEXITED(cst1) && !WIFSIGNALED(cst1)) {
+		    if (!child_exited)
+			waitret = waitpid(fpid, &waitstat, WNOHANG);
+		    if (!WIFEXITED(waitstat) && !WIFSIGNALED(waitstat)) {
 			kill(fpid, SIGTERM);
-			waitret = waitpid(fpid, &cst1, WNOHANG);
+			waitret = waitpid(fpid, &waitstat, WNOHANG);
 		    }
 		    break;
 	    	}
 
-#ifdef WNOWAIT
 		/*
 		**  Clean up if child exited before & no data received.  -BL
 		*/
 		if (child_exited) {
-		    waitret = waitpid(fpid, &cst1, WNOHANG);
+		    waitret = waitpid(fpid, &waitstat, WNOHANG);
 		    break;
 		}
 		/*
 		**  If child exited, loop once more looking for data.  -BL
 		*/
-		if ((waitret = waitpid(fpid, &cst1, WNOHANG | WNOWAIT)) > 0)
+		if ((waitret = waitpid(fpid, &waitstat, WNOHANG)) > 0) {
+		    /*
+		    **	Data will be arriving right now, so make sure we
+		    **	don't short-circuit out for too many loops, and
+		    **	skip the interrupt check.  -BL
+		    */
 		    child_exited = 1;
-#else
-		/*
-		**  End loop if child exited.
-		*/
-		if ((waitret = waitpid(fpid, &cst1, WNOHANG)) > 0)
-		    break;
-#endif
+		    cycle--;
+		    continue;
+		}
 
 		/*
 		**  Abort if interrupt key pressed.
@@ -613,24 +613,24 @@ PUBLIC int HTParseInet ARGS2(
 	    close(pfd[0]);
 	    if (waitret <= 0) {
 		kill(fpid, SIGTERM);
-		waitret = waitpid(fpid, &cst1, WNOHANG);
+		waitret = waitpid(fpid, &waitstat, WNOHANG);
 	    }
 	    if (waitret > 0) {
-		if (WIFEXITED(cst1)) {
+		if (WIFEXITED(waitstat)) {
 		    CTRACE(tfp, "HTParseInet: NSL_FORK child %d exited, status 0x%x.\n",
-				(int)waitret, cst1);
-		} else if (WIFSIGNALED(cst1)) {
+				(int)waitret, waitstat);
+		} else if (WIFSIGNALED(waitstat)) {
 		    CTRACE(tfp, "HTParseInet: NSL_FORK child %d got signal, status 0x%x!\n",
-				(int)waitret, cst1);
+				(int)waitret, waitstat);
 #ifdef WCOREDUMP
-		    if (WCOREDUMP(cst1)) {
+		    if (WCOREDUMP(waitstat)) {
 			CTRACE(tfp, "HTParseInet: NSL_FORK child %d dumped core!\n",
 				    (int)waitret);
 		    }
 #endif /* WCOREDUMP */
-		} else if (WIFSTOPPED(cst1)) {
+		} else if (WIFSTOPPED(waitstat)) {
 		    CTRACE(tfp, "HTParseInet: NSL_FORK child %d is stopped, status 0x%x!\n",
-				(int)waitret, cst1);
+				(int)waitret, waitstat);
 		}
 	    }
 	    if (!success) {
diff --git a/WWW/Library/Implementation/tcp.h b/WWW/Library/Implementation/tcp.h
index 3ebff46f..fba85b5b 100644
--- a/WWW/Library/Implementation/tcp.h
+++ b/WWW/Library/Implementation/tcp.h
@@ -295,6 +295,7 @@ extern char *vms_errno_string();
 #include <time.h>
 #include <types.h>
 #ifdef __TIME_T
+#undef  __TYPES
 #define __TYPES 1
 #define __TYPES_LOADED 1
 #endif /* __TIME_T */
@@ -307,9 +308,11 @@ extern char *vms_errno_string();
 #endif /* !__SOCKET_TYPEDEFS */
 #include "multinet_root:[multinet.include]errno.h"
 #ifdef __TYPES
+#undef  __TIME_T
 #define __TIME_T 1
 #endif /* __TYPE */
 #ifdef __TIME_LOADED
+#undef  __TIME
 #define __TIME 1  /* to avoid double definitions in in.h */
 #endif /* __TIME_LOADED */
 #include "multinet_root:[multinet.include.sys]time.h"