38 lines
871 B
C
38 lines
871 B
C
#ifndef HTTP
|
|
#define HTTP
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "picohttpparser.h"
|
|
|
|
#include "event_loop.h"
|
|
#include "http_req.h"
|
|
|
|
extern const char http_404[];
|
|
extern const size_t http_404_len;
|
|
extern const char http_405[];
|
|
extern const size_t http_405_len;
|
|
extern const char http_500[];
|
|
extern const size_t http_500_len;
|
|
|
|
typedef enum http_parse_error {
|
|
http_parse_error_ok = 0,
|
|
http_parse_error_incomplete = 1,
|
|
http_parse_error_invalid = 2,
|
|
} http_parse_error;
|
|
|
|
http_parse_error http_parse_request(http_request *req, const char *path,
|
|
size_t path_len);
|
|
|
|
void http_route(event_loop_conn *conn);
|
|
|
|
typedef enum http_response_type {
|
|
http_not_found = 404,
|
|
http_method_not_allowed = 405
|
|
} http_response_type;
|
|
|
|
void http_write_standard_response(event_loop_conn *conn,
|
|
http_response_type type);
|
|
|
|
#endif
|