summaryrefslogtreecommitdiff
path: root/src/libexec
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexec')
-rw-r--r--src/libexec/httpd.c4
1 files changed, 4 insertions, 0 deletions
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");