diff options
Diffstat (limited to 'main.h')
| -rw-r--r-- | main.h | 19 |
1 files changed, 19 insertions, 0 deletions
| @@ -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> | ||
| 64 | static 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 | |||
| 54 | typedef struct { | 72 | typedef 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 | ||
| 64 | void next_part(Http_Header * http_header, const char * content, size_t content_size); | 82 | void next_part(Http_Header * http_header, const char * content, size_t content_size); |
| 65 | void send_answer(Http_Header * http_header, int fd_socket); | 83 | void send_answer(Http_Header * http_header, int fd_socket); |
| 84 | void 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 |
