summaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
authorMax Christian Pohle2021-11-24 01:22:54 +0100
committerMax Christian Pohle2021-11-24 01:22:54 +0100
commitdb864e290ba1ec4acd74371b150e7770585ef284 (patch)
tree80f2ba16e4520bc1f4bfe28eac7fdb747c58710e /main.h
parent21ab0292a9c07d2377047969a4d530a15e465907 (diff)
downloadohmycgi-db864e290ba1ec4acd74371b150e7770585ef284.tar.bz2
ohmycgi-db864e290ba1ec4acd74371b150e7770585ef284.zip
Made the implementation more generic again
Diffstat (limited to 'main.h')
-rw-r--r--main.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/main.h b/main.h
index 02a9000..6588a40 100644
--- a/main.h
+++ b/main.h
@@ -51,6 +51,24 @@
51// #include <pthread.h> // maybe later 51// #include <pthread.h> // maybe later
52// }}} 52// }}}
53 53
54// {{{ MACROS
55#define EWOULDBLOCK_DELAY 100
56#define READ_BUFFER_LENGTH 9000 // jumboframe?
57#define POST_DATA_MAX_LENGTH 18000
58#define DEBUG_SLEEP_TIME 50000
59
60#ifndef DEBUG
61#define DEBUG(X, ...) // (X, ...)
62#else
63#include <stdarg.h>
64static inline int verbose(const char * format, ...) {
65 va_list va; va_start(va, format); usleep(DEBUG_SLEEP_TIME); return vprintf(format, va);
66}
67#undef DEBUG
68#define DEBUG verbose
69#endif
70// }}}
71
54typedef struct { 72typedef struct {
55 int newline_length; // lenght of one newline in bytes (\n has 1, CR/LF has 2) 73 int newline_length; // lenght of one newline in bytes (\n has 1, CR/LF has 2)
56 char * method; // GET/POST or something like that 74 char * method; // GET/POST or something like that
@@ -63,5 +81,6 @@ typedef struct {
63 81
64void next_part(Http_Header * http_header, const char * content, size_t content_size); 82void next_part(Http_Header * http_header, const char * content, size_t content_size);
65void send_answer(Http_Header * http_header, int fd_socket); 83void send_answer(Http_Header * http_header, int fd_socket);
84void parse_http(size_t new_socket, char * request, size_t request_length);
66 85
67// modeline for vim: shiftwidth=2 tabstop=2 number foldmethod=marker 86// modeline for vim: shiftwidth=2 tabstop=2 number foldmethod=marker
..