A low-key HTTP micro-framework for people who hate web bloat
git clone git://soophie.de/tpee
79
HTTP_STATUS_LOOP_DETECTED = 508,80
HTTP_STATUS_NOT_EXTENDED = 510,81
HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511,82
__HTTP_STATUS_HANDLED = 999,83
} http_status_t;85
typedef struct http http_t;
188
#define HTTP_VERSION "HTTP/1.1"189
#define HTTP_MAX_REQUEST_HEAD_SIZE 1000000190
#define HTTP_RESP_HANDLED (http_resp_t) { .status = __HTTP_STATUS_HANDLED }192
#define _HTTP_ON(method, path, fn_name) \193
static http_resp_t fn_name(http_req_t *req); \
876
}878
void http_resp_write(http_conn_t *conn, http_resp_t *resp) {879
if (resp->status == __HTTP_STATUS_HANDLED) {880
return;881
}882
bool has_content_length = false;883
if (resp->body != NULL) {884
if (resp->headers_len > 0) {