I think the new HTTP implementation is basically working, now.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4707 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-12-30 18:59:02 +00:00
parent 2f6a92168e
commit d02f17a8cf
6 changed files with 280 additions and 128 deletions

View File

@ -2,10 +2,11 @@
#include <stddef.h>
typedef struct uv_loop_s uv_loop_t;
typedef struct _tf_http_t tf_http_t;
typedef struct _tf_http_connection_t tf_http_connection_t;
typedef struct _tf_http_request_t tf_http_request_t;
typedef struct _tf_http_t tf_http_t;
typedef struct _tf_tls_context_t tf_tls_context_t;
typedef struct uv_loop_s uv_loop_t;
typedef enum _tf_http_callback_phase_t
{
@ -35,7 +36,7 @@ typedef struct _tf_http_request_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_listen(tf_http_t* http, int port, tf_tls_context_t* tls);
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);