diff options
-rw-r--r-- | src/bin/tsize.c | 2 | ||||
-rw-r--r-- | src/libexec/httpd.c | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/bin/tsize.c b/src/bin/tsize.c index 475308d..29ebf83 100644 --- a/src/bin/tsize.c +++ b/src/bin/tsize.c @@ -1,6 +1,8 @@ #include <stdio.h> #include <signal.h> +#include <unistd.h> #include <sys/ttycom.h> +#include <sys/ioctl.h> void winhand(int sig) { struct winsize ws; diff --git a/src/libexec/httpd.c b/src/libexec/httpd.c index 41339ae..8ba9413 100644 --- a/src/libexec/httpd.c +++ b/src/libexec/httpd.c @@ -1,3 +1,4 @@ +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -58,6 +59,8 @@ int main(int argc,char *argv[]) { setenv("QUERY_STRING",get_param,1); } } + signal(SIGALRM,exit); + alarm(10);//maximum of 10s to receive requests sound good? while(fgets(line,sizeof(line)-1,stdin)) { if(!strchr(line,'\n')) { printf("HTTP/1.1 413 Entity Too Large\r\n"); @@ -74,6 +77,7 @@ int main(int argc,char *argv[]) { break; } } + alarm(0);//no more timeout. //TODO: sanitize this. if(chdir(VHOST_ROOT) == -1) { printf("HTTP/1.1 500 Internal Server Error\r\n"); |