diff options
author | Roger Dingledine <arma@torproject.org> | 2002-07-20 02:01:18 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2002-07-20 02:01:18 +0000 |
commit | 61dc00bcaa0b532fb939ad2c780cf00e39cbc825 (patch) | |
tree | b455fb2d1419b1986f2c9f57be2169a6d5af9bb7 | |
parent | 1c3b823a82d58f4471b20e64854a82510185d59a (diff) | |
download | tor-61dc00bcaa0b532fb939ad2c780cf00e39cbc825.tar tor-61dc00bcaa0b532fb939ad2c780cf00e39cbc825.tar.gz |
bugfixes: don't hang waiting for new children to die; accept HTTP/1.1
svn:r67
-rw-r--r-- | src/httpap/http.h | 9 | ||||
-rw-r--r-- | src/httpap/httpap.c | 21 |
2 files changed, 19 insertions, 11 deletions
diff --git a/src/httpap/http.h b/src/httpap/http.h index cc2d20ccf..1be97b428 100644 --- a/src/httpap/http.h +++ b/src/httpap/http.h @@ -8,8 +8,11 @@ /* * Changes : * $Log$ - * Revision 1.1 2002/06/26 22:45:50 arma - * Initial revision + * 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 * * Revision 1.2 2002/04/02 14:27:33 badbytes * Final finishes. @@ -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 diff --git a/src/httpap/httpap.c b/src/httpap/httpap.c index c1c2ea537..cc3eab4df 100644 --- a/src/httpap/httpap.c +++ b/src/httpap/httpap.c @@ -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 @@ void print_usage() /* 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 @@ int handle_connection(int new_sock, struct hostent *local, struct sockaddr_in re 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 */ |