Some quick http refactors to make websockets less magic.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4705 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
10
src/http.h
10
src/http.h
@ -21,7 +21,6 @@ typedef struct _tf_http_request_t
|
||||
tf_http_connection_t* connection;
|
||||
const char* method;
|
||||
const char* path;
|
||||
int flags;
|
||||
const char* query;
|
||||
void* body;
|
||||
size_t content_length;
|
||||
@ -33,17 +32,11 @@ typedef struct _tf_http_request_t
|
||||
int ref_count;
|
||||
} tf_http_request_t;
|
||||
|
||||
typedef enum _tf_http_handler_flags_t
|
||||
{
|
||||
k_tf_http_handler_flag_none = 0,
|
||||
k_tf_http_handler_flag_websocket = 1,
|
||||
} tf_http_handler_flags_t;
|
||||
|
||||
typedef void (tf_http_callback_t)(tf_http_request_t* request);
|
||||
|
||||
tf_http_t* tf_http_create(uv_loop_t* loop);
|
||||
void tf_http_listen(tf_http_t* http, int port);
|
||||
void tf_http_add_handler(tf_http_t* http, const char* pattern, int flags, tf_http_callback_t* callback, void* user_data);
|
||||
void tf_http_add_handler(tf_http_t* http, const char* pattern, tf_http_callback_t* callback, void* user_data);
|
||||
void tf_http_respond(tf_http_request_t* request, int status, const char** headers, int headers_count, const void* body, size_t content_length);
|
||||
size_t tf_http_get_body(const tf_http_request_t* request, const void** out_data);
|
||||
void tf_http_destroy(tf_http_t* http);
|
||||
@ -52,3 +45,4 @@ void tf_http_request_ref(tf_http_request_t* request);
|
||||
void tf_http_request_release(tf_http_request_t* request);
|
||||
const char* tf_http_request_get_header(tf_http_request_t* request, const char* name);
|
||||
void tf_http_request_send(tf_http_request_t* request, const void* data, size_t size);
|
||||
void tf_http_request_websocket_upgrade(tf_http_request_t* request);
|
||||
|
Reference in New Issue
Block a user