From fd9f6169e93cab12eaa8d4d9b968afe67ddca878 Mon Sep 17 00:00:00 2001 From: epochqwert Date: Sat, 17 Jan 2015 00:25:01 -0600 Subject: updated tsize to not generate warnings added a timeout for httpd to accept requests of 10 seconds. --- src/libexec/httpd.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/libexec/httpd.c') 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 #include #include #include @@ -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"); -- cgit v1.2.3