diff options
author | epochqwert <epoch@53flpnlls43fcguy.onion> | 2015-01-17 00:25:01 -0600 |
---|---|---|
committer | epochqwert <epoch@53flpnlls43fcguy.onion> | 2015-01-17 00:25:01 -0600 |
commit | fd9f6169e93cab12eaa8d4d9b968afe67ddca878 (patch) | |
tree | a95ec96ee782d2eeb2caaa12e0e97af8799f86c4 /src | |
parent | eaf6e1e1a941b8e0b52abadcd8b55901d5cf5301 (diff) | |
download | misc-fd9f6169e93cab12eaa8d4d9b968afe67ddca878.tar.gz misc-fd9f6169e93cab12eaa8d4d9b968afe67ddca878.zip |
updated tsize to not generate warnings
added a timeout for httpd to accept requests of 10 seconds.
Diffstat (limited to 'src')
-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"); |