@@ 7,6 7,7 @@
#include <unistd.h>
#include <getopt.h>
#include <fcntl.h>
+#include <time.h>
#include <event2/event.h>
#include <event2/listener.h>
#include <event2/buffer.h>
@@ 27,9 28,6 @@ extern char *optarg;
int sockfd;
SSL_CTX *sslctx;
-char *res;
-size_t reslen;
-
#define MAX_HOSTNAME_LEN 512
#define MAX_PATH_LEN 2048
@@ 255,6 253,11 @@ read_request(struct bufferevent *bev, void *ctx)
return;
}
+ time_t now = time(0);
+ struct tm *reqtime = gmtime(&now);
+ char datebuf[20];
+ strftime (datebuf, sizeof(datebuf), "%Y-%m-%d %H:%M:%S", reqtime);
+ printf("%s Serving request: %s\n", datebuf, line);
strcpy(path, rootdir);
append_index(url.route);
@@ 272,7 275,6 @@ read_request(struct bufferevent *bev, void *ctx)
write_header(output, 20, "text/gemini");
evbuffer_add_file(output, filefd, 0, fsize);
- bufferevent_write(bev, res, reslen);
}
void