diff --git a/examples/server/000_http_server.c b/examples/server/000_http_server.c index ca9e0d3..bfed2e6 100644 --- a/examples/server/000_http_server.c +++ b/examples/server/000_http_server.c @@ -6,6 +6,8 @@ int main(void) { + http_global_init(); + // Choose the interface to listen on and the port. // Currently, servers can only bind to IPv4 addresses. HTTP_String addr = HTTP_STR("127.0.0.1"); @@ -90,6 +92,7 @@ int main(void) // your server in a way to exit gracefully, this is // you the server object is freed: http_server_free(server); + http_global_free(); // Have fun. Bye! return 0; diff --git a/examples/server/010_zero_copy_api.c b/examples/server/010_zero_copy_api.c index e7cda4b..b04b4e9 100644 --- a/examples/server/010_zero_copy_api.c +++ b/examples/server/010_zero_copy_api.c @@ -6,6 +6,8 @@ int main(void) { + http_global_init(); + // All the setup is identical to the previous example. // The only thing that changes where "http_response_body" // is called. @@ -90,5 +92,6 @@ int main(void) } http_server_free(server); + http_global_free(); return 0; } diff --git a/examples/server/020_response_undo.c b/examples/server/020_response_undo.c index 6055c6a..9616119 100644 --- a/examples/server/020_response_undo.c +++ b/examples/server/020_response_undo.c @@ -6,6 +6,8 @@ int main(void) { + http_global_init(); + HTTP_Server *server = http_server_init(HTTP_STR("127.0.0.1"), 8080); if (server == NULL) return -1; @@ -52,5 +54,6 @@ int main(void) } http_server_free(server); + http_global_free(); return 0; } diff --git a/examples/server/030_using_workers.c b/examples/server/030_using_workers.c index ff4cc1d..89fbc60 100644 --- a/examples/server/030_using_workers.c +++ b/examples/server/030_using_workers.c @@ -118,6 +118,7 @@ ThreadReturn worker(void*) int main(void) { + http_global_free(); init_job_queue(); HTTP_Server *server = http_server_init(HTTP_STR("127.0.0.1"), 8080); @@ -177,6 +178,7 @@ int main(void) http_server_free(server); free_job_queue(); + http_global_free(); return 0; } diff --git a/examples/server/050_https_server.c b/examples/server/050_https_server.c index 6be54b2..0a5f2c3 100644 --- a/examples/server/050_https_server.c +++ b/examples/server/050_https_server.c @@ -7,6 +7,8 @@ int main(void) { + http_global_init(); + // To setup an HTTPS server, we need to use the *_ex variant // of the server initialization function as it offers more // control. Server objects can serve HTTP traffic, HTTPS @@ -71,5 +73,6 @@ int main(void) } http_server_free(server); + http_global_free(); return 0; } \ No newline at end of file diff --git a/examples/server/060_virtual_hosts_over_https.c b/examples/server/060_virtual_hosts_over_https.c index aec2c06..70a6746 100644 --- a/examples/server/060_virtual_hosts_over_https.c +++ b/examples/server/060_virtual_hosts_over_https.c @@ -8,6 +8,8 @@ int setup_test_certificates(void); int main(void) { + http_global_init(); + // First, create three certificates for the domains: // // websiteA.com @@ -118,6 +120,7 @@ int main(void) } http_server_free(server); + http_global_free(); return 0; }