aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/examples/demo.c7
-rw-r--r--src/examples/demo_https.c7
-rw-r--r--src/examples/http_compression.c8
-rw-r--r--src/examples/post_example.c14
-rw-r--r--src/examples/querystring_example.c6
-rw-r--r--src/include/microhttpd.h10
6 files changed, 31 insertions, 21 deletions
diff --git a/src/examples/demo.c b/src/examples/demo.c
index 1c24a57e..9aef573a 100644
--- a/src/examples/demo.c
+++ b/src/examples/demo.c
@@ -383,9 +383,10 @@ update_directory (void)
383 "%s", 383 "%s",
384 INDEX_PAGE_FOOTER); 384 INDEX_PAGE_FOOTER);
385 initial_allocation = rdc.buf_len; /* remember for next time */ 385 initial_allocation = rdc.buf_len; /* remember for next time */
386 response = MHD_create_response_from_buffer (rdc.off, 386 response =
387 rdc.buf, 387 MHD_create_response_from_buffer_with_free_callback (rdc.off,
388 MHD_RESPMEM_MUST_FREE); 388 rdc.buf,
389 &free);
389 mark_as_html (response); 390 mark_as_html (response);
390#if FORCE_CLOSE 391#if FORCE_CLOSE
391 (void) MHD_add_response_header (response, 392 (void) MHD_add_response_header (response,
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c
index 1a09d2c2..56008d7f 100644
--- a/src/examples/demo_https.c
+++ b/src/examples/demo_https.c
@@ -385,9 +385,10 @@ update_directory (void)
385 "%s", 385 "%s",
386 INDEX_PAGE_FOOTER); 386 INDEX_PAGE_FOOTER);
387 initial_allocation = rdc.buf_len; /* remember for next time */ 387 initial_allocation = rdc.buf_len; /* remember for next time */
388 response = MHD_create_response_from_buffer (rdc.off, 388 response =
389 rdc.buf, 389 MHD_create_response_from_buffer_with_free_callback (rdc.off,
390 MHD_RESPMEM_MUST_FREE); 390 rdc.buf,
391 &free);
391 mark_as_html (response); 392 mark_as_html (response);
392#if FORCE_CLOSE 393#if FORCE_CLOSE
393 (void) MHD_add_response_header (response, 394 (void) MHD_add_response_header (response,
diff --git a/src/examples/http_compression.c b/src/examples/http_compression.c
index a91a39a3..0f532cf0 100644
--- a/src/examples/http_compression.c
+++ b/src/examples/http_compression.c
@@ -130,9 +130,11 @@ ahc_echo (void *cls,
130 can_compress (connection)) 130 can_compress (connection))
131 comp = body_compress ((void **) &body_str, 131 comp = body_compress ((void **) &body_str,
132 &body_len); 132 &body_len);
133 response = MHD_create_response_from_buffer (body_len, 133 response =
134 body_str, 134 MHD_create_response_from_buffer_with_free_callback (body_len,
135 MHD_RESPMEM_MUST_FREE); 135 body_str,
136 &free);
137
136 if (NULL == response) 138 if (NULL == response)
137 { 139 {
138 free (body_str); 140 free (body_str);
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index 709fc918..1b6a5a03 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -332,9 +332,10 @@ fill_v1_form (const void *cls,
332 MAIN_PAGE, 332 MAIN_PAGE,
333 session->value_1); 333 session->value_1);
334 /* return static form */ 334 /* return static form */
335 response = MHD_create_response_from_buffer (slen, 335 response =
336 (void *) reply, 336 MHD_create_response_from_buffer_with_free_callback (slen,
337 MHD_RESPMEM_MUST_FREE); 337 (void *) reply,
338 &free);
338 if (NULL == response) 339 if (NULL == response)
339 { 340 {
340 free (reply); 341 free (reply);
@@ -383,9 +384,10 @@ fill_v1_v2_form (const void *cls,
383 session->value_1, 384 session->value_1,
384 session->value_2); 385 session->value_2);
385 /* return static form */ 386 /* return static form */
386 response = MHD_create_response_from_buffer (slen, 387 response =
387 (void *) reply, 388 MHD_create_response_from_buffer_with_free_callback (slen,
388 MHD_RESPMEM_MUST_FREE); 389 (void *) reply,
390 &free);
389 if (NULL == response) 391 if (NULL == response)
390 { 392 {
391 free (reply); 393 free (reply);
diff --git a/src/examples/querystring_example.c b/src/examples/querystring_example.c
index 57de5aa7..97a92ae2 100644
--- a/src/examples/querystring_example.c
+++ b/src/examples/querystring_example.c
@@ -72,8 +72,10 @@ ahc_echo (void *cls,
72 free (me); 72 free (me);
73 return MHD_NO; /* Error forming the response body */ 73 return MHD_NO; /* Error forming the response body */
74 } 74 }
75 response = MHD_create_response_from_buffer (resp_len, me, 75 response =
76 MHD_RESPMEM_MUST_FREE); 76 MHD_create_response_from_buffer_with_free_callback (resp_len,
77 (void *) me,
78 &free);
77 if (response == NULL) 79 if (response == NULL)
78 { 80 {
79 free (me); 81 free (me);
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 921ab56b..2f3a99a9 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -3624,10 +3624,12 @@ enum MHD_ResponseMemoryMode
3624 * Buffer is heap-allocated with `malloc()` (or equivalent) and 3624 * Buffer is heap-allocated with `malloc()` (or equivalent) and
3625 * should be freed by MHD after processing the response has 3625 * should be freed by MHD after processing the response has
3626 * concluded (response reference counter reaches zero). 3626 * concluded (response reference counter reaches zero).
3627 * @warning Make sure that your application and MHD are using the same 3627 * The more portable way to automatically free the buffer is function
3628 * C-runtime library (especially important for W32). if in doubt, 3628 * MHD_create_response_from_buffer_with_free_callback() with '&free' as
3629 * use function MHD_create_response_from_buffer_with_free_callback() 3629 * crfc parameter as it does not require to use the same runtime library.
3630 * with '&free' as crfc parameter. 3630 * @warning It is critical to make sure that the same C-runtime library
3631 * is used by both application and MHD (especially
3632 * important for W32).
3631 * @ingroup response 3633 * @ingroup response
3632 */ 3634 */
3633 MHD_RESPMEM_MUST_FREE, 3635 MHD_RESPMEM_MUST_FREE,