Add global state initialization functions

This commit is contained in:
2025-07-21 21:37:02 +02:00
parent a2912b5191
commit 58f8ace725
17 changed files with 242 additions and 94 deletions
+3 -5
View File
@@ -171,6 +171,7 @@ typedef struct {
} HTTP_Request;
typedef struct {
void* context;
int minor;
int status;
HTTP_String reason;
@@ -186,9 +187,6 @@ int http_parse_request (char *src, int len, HTTP_Request *req);
int http_parse_response (char *src, int len, HTTP_Response *res);
int http_find_header (HTTP_Header *headers, int num_headers, HTTP_String name);
HTTP_String http_getqueryparam (HTTP_Request *req, HTTP_String name);
HTTP_String http_getbodyparam (HTTP_Request *req, HTTP_String name);
HTTP_String http_getcookie (HTTP_Request *req, HTTP_String name);
#endif // PARSE_INCLUDED
@@ -370,7 +368,7 @@ int http_create_test_certificate(HTTP_String C, HTTP_String O, HTTP_String CN,
// cHTTP tries to avoid global state. What this function
// does is call the global initialization functions of
// its dependencies (OpenSSL and Winsock)
void http_global_init(void);
int http_global_init(void);
// Free the global state of cHTTP.
void http_global_free(void);
@@ -429,7 +427,7 @@ void http_request_builder_submit(HTTP_RequestBuilder builder);
// after the request has completed.
//
// TODO: allow aborting pending requests
void http_response_free(HTTP_Client *client, HTTP_Response *res);
void http_response_free(HTTP_Response *res);
// Wait for the completion of one request associated to
// the client. The handle of the resolved request is returned