[or-cvs] bugfixes: don"t hang waiting for new children to die; accep...

Roger Dingledine arma at seul.org
Sat Jul 20 02:01:20 UTC 2002


Update of /home/or/cvsroot/src/httpap
In directory moria.seul.org:/home/arma/work/onion/cvs/src/httpap

Modified Files:
	http.h httpap.c 
Log Message:
bugfixes: don't hang waiting for new children to die; accept HTTP/1.1



Index: http.h
===================================================================
RCS file: /home/or/cvsroot/src/httpap/http.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- http.h	26 Jun 2002 22:45:50 -0000	1.1.1.1
+++ http.h	20 Jul 2002 02:01:18 -0000	1.2
@@ -8,6 +8,9 @@
 /*
  * Changes :
  * $Log$
+ * Revision 1.2  2002/07/20 02:01:18  arma
+ * bugfixes: don't hang waiting for new children to die; accept HTTP/1.1
+ *
  * Revision 1.1.1.1  2002/06/26 22:45:50  arma
  * initial commit: current code
  *
@@ -28,7 +31,7 @@
 #define HTTPAP_VERSION "HTTP/1.0"
 
 #define HTTPAP_STATUS_LINE_FORBIDDEN HTTPAP_VERSION " 403 Only local connections are allowed." HTTPAP_CRLF
-#define HTTPAP_STATUS_LINE_VERSION_NOT_SUPPORTED HTTPAP_VERSION " 505 Only HTTP/1.0 is supported." HTTPAP_CRLF
+#define HTTPAP_STATUS_LINE_VERSION_NOT_SUPPORTED HTTPAP_VERSION " 501 Only HTTP/1.0 is supported." HTTPAP_CRLF
 #define HTTPAP_STATUS_LINE_UNAVAILABLE HTTPAP_VERSION " 503 Connection to the server failed." HTTPAP_CRLF
 #define HTTPAP_STATUS_LINE_BAD_REQUEST HTTPAP_VERSION " 400 Invalid syntax." HTTPAP_CRLF
 #define HTTPAP_STATUS_LINE_UNEXPECTED HTTPAP_VERSION " 500 Internal server error." HTTPAP_CRLF

Index: httpap.c
===================================================================
RCS file: /home/or/cvsroot/src/httpap/httpap.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- httpap.c	19 Jul 2002 18:48:19 -0000	1.4
+++ httpap.c	20 Jul 2002 02:01:18 -0000	1.5
@@ -8,6 +8,9 @@
 /*
  * Changes :
  * $Log$
+ * Revision 1.5  2002/07/20 02:01:18  arma
+ * bugfixes: don't hang waiting for new children to die; accept HTTP/1.1
+ *
  * Revision 1.4  2002/07/19 18:48:19  arma
  * slightly less noisy
  *
@@ -97,8 +100,10 @@
 /* used for reaping zombie processes */
 void sigchld_handler(int s)
 {
-  while (wait(NULL) > 0);
-  connections--;
+  while((waitpid (-1, NULL, WNOHANG)) > 0) {
+//  while (wait(NULL) > 0);
+    connections--;
+  }
 }
 
 int handle_connection(int new_sock, struct hostent *local, struct sockaddr_in remote, uint16_t op_port)
@@ -177,12 +182,12 @@
     return -1;
   }
   log(LOG_DEBUG,"handle_connection : Client's version is : %s.",http_ver);
-  if (strcmp(http_ver, HTTPAP_VERSION)) /* not supported */
-  {
-    log(LOG_DEBUG,"handle_connection : Client's version is %s, I only support HTTP/1.0.",http_ver);
-    write_tout(new_sock, HTTPAP_STATUS_LINE_VERSION_NOT_SUPPORTED, strlen(HTTPAP_STATUS_LINE_VERSION_NOT_SUPPORTED), conn_toutp);
-    return -1;
-  }
+//  if (strcmp(http_ver, HTTPAP_VERSION)) /* not supported */
+//  {
+//    log(LOG_DEBUG,"handle_connection : Client's version is %s, I only support HTTP/1.0.",http_ver);
+//    write_tout(new_sock, HTTPAP_STATUS_LINE_VERSION_NOT_SUPPORTED, strlen(HTTPAP_STATUS_LINE_VERSION_NOT_SUPPORTED), conn_toutp);
+//    return -1;
+//  }
   free((void *)http_ver);
   
   /* extract the destination address and port */



More information about the tor-commits mailing list