Compare commits

..
4 Commits
14 .. 16
Author SHA1 Message Date
Arjan van de Ven 71f4e789c4 better logging 2015-03-23 14:17:30 -04:00
Arjan van de Ven f776162882 few more checks 2015-03-23 14:15:42 -04:00
Arjan van de Ven a2abd8d2a9 put memory optimizations back 2015-03-23 14:12:31 -04:00
Arjan van de Ven 8844b0b0e1 Revert "Wait with curl init until the first connection comes in"
This reverts commit 6fb3c6f193.
2015-03-05 18:00:06 -05:00
+7 -2
View File
@@ -36,6 +36,7 @@
#include <string.h>
#include <pthread.h>
#include <sys/stat.h>
#include <malloc.h>
#include <curl/curl.h>
#include <glib.h>
@@ -185,7 +186,7 @@ static void *server_thread(void *arg)
path++;
if (strstr(path, "..") || strstr(prefix, "..")) {
if (strstr(path, "..") || strstr(prefix, "..") || strstr(path, "'") || strstr(path, ";")) {
close(fd);
return NULL;
}
@@ -212,6 +213,9 @@ static void *server_thread(void *arg)
if (timedelta(before, after) > 0.6)
printf("Request for %s took %5.2f seconds (%i - %i)\n", url,
after.tv_sec - before.tv_sec + (1.0*after.tv_usec - before.tv_usec) / 1000000.0, ret, (int)timestamp);
if (ret != 200)
printf("Request for %s resulted in error %i\n", url, ret);
free(url);
return NULL;
}
@@ -259,8 +263,9 @@ int main(int argc, char **argv)
int clientsock;
pthread_t thread;
malloc_trim(0);
clientsock = accept(sockfd, NULL, NULL);
if (!curl_done) {
curl_global_init(CURL_GLOBAL_ALL);
curl_done = 1;