aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-01-04 12:40:03 +0000
committerChristian Grothoff <christian@grothoff.org>2011-01-04 12:40:03 +0000
commit43542a78c6bfc10dc06196c0702b802eb6a45591 (patch)
tree3857b4ec8cd7ce3c8cbba77de74902cdd6b92c10 /src
parent3af8f4ce646d29cd5942a1e3dda3b7ed03a82af6 (diff)
downloadlibmicrohttpd-43542a78c6bfc10dc06196c0702b802eb6a45591.tar.gz
libmicrohttpd-43542a78c6bfc10dc06196c0702b802eb6a45591.zip
introducing MHD_create_response_from_buffer, deprecating MHD_create_response_from_data
Diffstat (limited to 'src')
-rw-r--r--src/daemon/connection.c10
-rw-r--r--src/daemon/response.c25
-rw-r--r--src/examples/authorization_example.c11
-rw-r--r--src/examples/digest_auth_example.c16
-rw-r--r--src/examples/fileserver_example.c6
-rw-r--r--src/examples/fileserver_example_dirs.c7
-rw-r--r--src/examples/fileserver_example_external_select.c6
-rw-r--r--src/examples/https_fileserver_example.c6
-rw-r--r--src/examples/minimal_example.c5
-rw-r--r--src/examples/querystring_example.c3
-rw-r--r--src/examples/refuse_post_example.c11
-rw-r--r--src/include/microhttpd.h50
-rw-r--r--src/testcurl/daemontest_digestauth.c16
-rw-r--r--src/testcurl/daemontest_get.c5
-rw-r--r--src/testcurl/daemontest_iplimit.c5
-rw-r--r--src/testcurl/daemontest_large_put.c5
-rw-r--r--src/testcurl/daemontest_long_header.c5
-rw-r--r--src/testcurl/daemontest_parse_cookies.c5
-rw-r--r--src/testcurl/daemontest_post.c9
-rw-r--r--src/testcurl/daemontest_post_loop.c3
-rw-r--r--src/testcurl/daemontest_postform.c6
-rw-r--r--src/testcurl/daemontest_process_arguments.c5
-rw-r--r--src/testcurl/daemontest_process_headers.c5
-rw-r--r--src/testcurl/daemontest_put.c4
-rw-r--r--src/testcurl/daemontest_put_chunked.c5
-rw-r--r--src/testcurl/daemontest_termination.c3
-rw-r--r--src/testcurl/daemontest_timeout.c5
-rw-r--r--src/testcurl/https/mhds_get_test_select.c5
-rw-r--r--src/testcurl/https/mhds_session_info_test.c6
-rw-r--r--src/testcurl/https/tls_test_common.c6
-rw-r--r--src/testzzuf/daemontest_get.c5
-rw-r--r--src/testzzuf/daemontest_large_put.c5
-rw-r--r--src/testzzuf/daemontest_long_header.c5
-rw-r--r--src/testzzuf/daemontest_post.c6
-rw-r--r--src/testzzuf/daemontest_postform.c6
-rw-r--r--src/testzzuf/daemontest_put.c5
-rw-r--r--src/testzzuf/daemontest_put_chunked.c5
37 files changed, 196 insertions, 100 deletions
diff --git a/src/daemon/connection.c b/src/daemon/connection.c
index 8a6d4619..f20614dc 100644
--- a/src/daemon/connection.c
+++ b/src/daemon/connection.c
@@ -716,8 +716,9 @@ transmit_error_response (struct MHD_Connection *connection,
716 status_code, message); 716 status_code, message);
717#endif 717#endif
718 EXTRA_CHECK (connection->response == NULL); 718 EXTRA_CHECK (connection->response == NULL);
719 response = MHD_create_response_from_data (strlen (message), 719 response = MHD_create_response_from_buffer (strlen (message),
720 (void *) message, MHD_NO, MHD_NO); 720 (void *) message,
721 MHD_RESPMEM_PERSISTENT);
721 MHD_queue_response (connection, status_code, response); 722 MHD_queue_response (connection, status_code, response);
722 EXTRA_CHECK (connection->response != NULL); 723 EXTRA_CHECK (connection->response != NULL);
723 MHD_destroy_response (response); 724 MHD_destroy_response (response);
@@ -1663,8 +1664,9 @@ parse_connection_headers (struct MHD_Connection *connection)
1663#endif 1664#endif
1664 EXTRA_CHECK (connection->response == NULL); 1665 EXTRA_CHECK (connection->response == NULL);
1665 response = 1666 response =
1666 MHD_create_response_from_data (strlen (REQUEST_LACKS_HOST), 1667 MHD_create_response_from_buffer (strlen (REQUEST_LACKS_HOST),
1667 REQUEST_LACKS_HOST, MHD_NO, MHD_NO); 1668 REQUEST_LACKS_HOST,
1669 MHD_RESPMEM_PERSISTENT);
1668 MHD_queue_response (connection, MHD_HTTP_BAD_REQUEST, response); 1670 MHD_queue_response (connection, MHD_HTTP_BAD_REQUEST, response);
1669 MHD_destroy_response (response); 1671 MHD_destroy_response (response);
1670 return; 1672 return;
diff --git a/src/daemon/response.c b/src/daemon/response.c
index 7d9ae17c..db846674 100644
--- a/src/daemon/response.c
+++ b/src/daemon/response.c
@@ -352,6 +352,7 @@ struct MHD_Response *MHD_create_response_from_fd (size_t size,
352 * right away, the data maybe released anytime after 352 * right away, the data maybe released anytime after
353 * this call returns 353 * this call returns
354 * @return NULL on error (i.e. invalid arguments, out of memory) 354 * @return NULL on error (i.e. invalid arguments, out of memory)
355 * @deprecated use MHD_create_response_from_buffer instead
355 */ 356 */
356struct MHD_Response * 357struct MHD_Response *
357MHD_create_response_from_data (size_t size, 358MHD_create_response_from_data (size_t size,
@@ -382,7 +383,7 @@ MHD_create_response_from_data (size_t size,
382 return NULL; 383 return NULL;
383 } 384 }
384 memcpy (tmp, data, size); 385 memcpy (tmp, data, size);
385 must_free = 1; 386 must_free = MHD_YES;
386 data = tmp; 387 data = tmp;
387 } 388 }
388 retVal->crc = NULL; 389 retVal->crc = NULL;
@@ -395,6 +396,28 @@ MHD_create_response_from_data (size_t size,
395 return retVal; 396 return retVal;
396} 397}
397 398
399
400/**
401 * Create a response object. The response object can be extended with
402 * header information and then be used any number of times.
403 *
404 * @param size size of the data portion of the response
405 * @param buffer size bytes containing the response's data portion
406 * @param mode flags for buffer management
407 * @return NULL on error (i.e. invalid arguments, out of memory)
408 */
409struct MHD_Response *
410MHD_create_response_from_buffer (size_t size,
411 void *buffer,
412 enum MHD_ResponseMemoryMode mode)
413{
414 return MHD_create_response_from_data (size,
415 buffer,
416 mode == MHD_RESPMEM_MUST_FREE,
417 mode == MHD_RESPMEM_MUST_COPY);
418}
419
420
398/** 421/**
399 * Destroy a response object and associated resources. Note that 422 * Destroy a response object and associated resources. Note that
400 * libmicrohttpd may keep some of the resources around if the response 423 * libmicrohttpd may keep some of the resources around if the response
diff --git a/src/examples/authorization_example.c b/src/examples/authorization_example.c
index b271053e..60512183 100644
--- a/src/examples/authorization_example.c
+++ b/src/examples/authorization_example.c
@@ -63,17 +63,18 @@ ahc_echo (void *cls,
63 (0 != strcmp (auth, "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="))) 63 (0 != strcmp (auth, "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")))
64 { 64 {
65 /* require: "Aladdin" with password "open sesame" */ 65 /* require: "Aladdin" with password "open sesame" */
66 response = MHD_create_response_from_data (strlen (DENIED), 66 response = MHD_create_response_from_buffer (strlen (DENIED),
67 (void *) DENIED, MHD_NO, 67 (void *) DENIED,
68 MHD_NO); 68 MHD_RESPMEM_PERSISTENT);
69 MHD_add_response_header (response, MHD_HTTP_HEADER_WWW_AUTHENTICATE, 69 MHD_add_response_header (response, MHD_HTTP_HEADER_WWW_AUTHENTICATE,
70 "Basic realm=\"TestRealm\""); 70 "Basic realm=\"TestRealm\"");
71 code = MHD_HTTP_UNAUTHORIZED; 71 code = MHD_HTTP_UNAUTHORIZED;
72 } 72 }
73 else 73 else
74 { 74 {
75 response = MHD_create_response_from_data (strlen (me), 75 response = MHD_create_response_from_buffer (strlen (me),
76 (void *) me, MHD_NO, MHD_NO); 76 (void *) me,
77 MHD_RESPMEM_PERSISTENT);
77 code = MHD_HTTP_OK; 78 code = MHD_HTTP_OK;
78 } 79 }
79 ret = MHD_queue_response (connection, code, response); 80 ret = MHD_queue_response (connection, code, response);
diff --git a/src/examples/digest_auth_example.c b/src/examples/digest_auth_example.c
index bf6f896f..01f09dec 100644
--- a/src/examples/digest_auth_example.c
+++ b/src/examples/digest_auth_example.c
@@ -49,9 +49,9 @@ ahc_echo (void *cls,
49 username = MHD_digest_auth_get_username(connection); 49 username = MHD_digest_auth_get_username(connection);
50 if (username == NULL) 50 if (username == NULL)
51 { 51 {
52 response = MHD_create_response_from_data(strlen (DENIED), 52 response = MHD_create_response_from_buffer(strlen (DENIED),
53 DENIED, 53 DENIED,
54 MHD_NO, MHD_NO); 54 MHD_RESPMEM_PERSISTENT);
55 ret = MHD_queue_auth_fail_response(connection, realm, 55 ret = MHD_queue_auth_fail_response(connection, realm,
56 OPAQUE, 56 OPAQUE,
57 response, 57 response,
@@ -67,9 +67,9 @@ ahc_echo (void *cls,
67 if ( (ret == MHD_INVALID_NONCE) || 67 if ( (ret == MHD_INVALID_NONCE) ||
68 (ret == MHD_NO) ) 68 (ret == MHD_NO) )
69 { 69 {
70 response = MHD_create_response_from_data(strlen (DENIED), 70 response = MHD_create_response_from_buffer(strlen (DENIED),
71 DENIED, 71 DENIED,
72 MHD_NO, MHD_NO); 72 MHD_RESPMEM_PERSISTENT);
73 if (NULL == response) 73 if (NULL == response)
74 return MHD_NO; 74 return MHD_NO;
75 ret = MHD_queue_auth_fail_response(connection, realm, 75 ret = MHD_queue_auth_fail_response(connection, realm,
@@ -79,8 +79,8 @@ ahc_echo (void *cls,
79 MHD_destroy_response(response); 79 MHD_destroy_response(response);
80 return ret; 80 return ret;
81 } 81 }
82 response = MHD_create_response_from_data(strlen(PAGE), PAGE, 82 response = MHD_create_response_from_buffer(strlen(PAGE), PAGE,
83 MHD_NO, MHD_NO); 83 MHD_RESPMEM_PERSISTENT);
84 ret = MHD_queue_response(connection, MHD_HTTP_OK, response); 84 ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
85 MHD_destroy_response(response); 85 MHD_destroy_response(response);
86 return ret; 86 return ret;
diff --git a/src/examples/fileserver_example.c b/src/examples/fileserver_example.c
index f470a236..4441ac49 100644
--- a/src/examples/fileserver_example.c
+++ b/src/examples/fileserver_example.c
@@ -75,9 +75,9 @@ ahc_echo (void *cls,
75 file = NULL; 75 file = NULL;
76 if (file == NULL) 76 if (file == NULL)
77 { 77 {
78 response = MHD_create_response_from_data (strlen (PAGE), 78 response = MHD_create_response_from_buffer (strlen (PAGE),
79 (void *) PAGE, 79 (void *) PAGE,
80 MHD_NO, MHD_NO); 80 MHD_RESPMEM_PERSISTENT);
81 ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response); 81 ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response);
82 MHD_destroy_response (response); 82 MHD_destroy_response (response);
83 } 83 }
diff --git a/src/examples/fileserver_example_dirs.c b/src/examples/fileserver_example_dirs.c
index 836c0623..d5be6e2d 100644
--- a/src/examples/fileserver_example_dirs.c
+++ b/src/examples/fileserver_example_dirs.c
@@ -117,10 +117,9 @@ ahc_echo (void *cls,
117 sizeof (emsg), 117 sizeof (emsg),
118 "Failed to open directory `.': %s\n", 118 "Failed to open directory `.': %s\n",
119 strerror (errno)); 119 strerror (errno));
120 response = MHD_create_response_from_data (strlen (emsg), 120 response = MHD_create_response_from_buffer (strlen (emsg),
121 emsg, 121 emsg,
122 MHD_NO, 122 MHD_RESPMEM_MUST_COPY);
123 MHD_YES);
124 if (response == NULL) 123 if (response == NULL)
125 return MHD_NO; 124 return MHD_NO;
126 ret = MHD_queue_response (connection, MHD_HTTP_SERVICE_UNAVAILABLE, response); 125 ret = MHD_queue_response (connection, MHD_HTTP_SERVICE_UNAVAILABLE, response);
diff --git a/src/examples/fileserver_example_external_select.c b/src/examples/fileserver_example_external_select.c
index a4dfcc1c..a7ab824a 100644
--- a/src/examples/fileserver_example_external_select.c
+++ b/src/examples/fileserver_example_external_select.c
@@ -76,9 +76,9 @@ ahc_echo (void *cls,
76 file = NULL; 76 file = NULL;
77 if (file == NULL) 77 if (file == NULL)
78 { 78 {
79 response = MHD_create_response_from_data (strlen (PAGE), 79 response = MHD_create_response_from_buffer (strlen (PAGE),
80 (void *) PAGE, 80 (void *) PAGE,
81 MHD_NO, MHD_NO); 81 MHD_RESPMEM_PERSISTENT);
82 ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response); 82 ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response);
83 MHD_destroy_response (response); 83 MHD_destroy_response (response);
84 } 84 }
diff --git a/src/examples/https_fileserver_example.c b/src/examples/https_fileserver_example.c
index fe1512ed..ca9d8a32 100644
--- a/src/examples/https_fileserver_example.c
+++ b/src/examples/https_fileserver_example.c
@@ -144,9 +144,9 @@ http_ahc (void *cls,
144 file = NULL; 144 file = NULL;
145 if (file == NULL) 145 if (file == NULL)
146 { 146 {
147 response = MHD_create_response_from_data (strlen (EMPTY_PAGE), 147 response = MHD_create_response_from_buffer (strlen (EMPTY_PAGE),
148 (void *) EMPTY_PAGE, 148 (void *) EMPTY_PAGE,
149 MHD_NO, MHD_NO); 149 MHD_RESPMEM_PERSISTENT);
150 ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response); 150 ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response);
151 MHD_destroy_response (response); 151 MHD_destroy_response (response);
152 } 152 }
diff --git a/src/examples/minimal_example.c b/src/examples/minimal_example.c
index 992a7ca3..9293242b 100644
--- a/src/examples/minimal_example.c
+++ b/src/examples/minimal_example.c
@@ -49,8 +49,9 @@ ahc_echo (void *cls,
49 return MHD_YES; 49 return MHD_YES;
50 } 50 }
51 *ptr = NULL; /* reset when done */ 51 *ptr = NULL; /* reset when done */
52 response = MHD_create_response_from_data (strlen (me), 52 response = MHD_create_response_from_buffer (strlen (me),
53 (void *) me, MHD_NO, MHD_NO); 53 (void *) me,
54 MHD_RESPMEM_PERSISTENT);
54 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 55 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
55 MHD_destroy_response (response); 56 MHD_destroy_response (response);
56 return ret; 57 return ret;
diff --git a/src/examples/querystring_example.c b/src/examples/querystring_example.c
index b9f6fb47..533fc8e5 100644
--- a/src/examples/querystring_example.c
+++ b/src/examples/querystring_example.c
@@ -57,7 +57,8 @@ ahc_echo (void *cls,
57 if (me == NULL) 57 if (me == NULL)
58 return MHD_NO; 58 return MHD_NO;
59 sprintf (me, fmt, "q", val); 59 sprintf (me, fmt, "q", val);
60 response = MHD_create_response_from_data (strlen (me), me, MHD_YES, MHD_NO); 60 response = MHD_create_response_from_buffer (strlen (me), me,
61 MHD_RESPMEM_MUST_FREE);
61 if (response == NULL) 62 if (response == NULL)
62 { 63 {
63 free (me); 64 free (me);
diff --git a/src/examples/refuse_post_example.c b/src/examples/refuse_post_example.c
index 5445160b..0c389bb0 100644
--- a/src/examples/refuse_post_example.c
+++ b/src/examples/refuse_post_example.c
@@ -56,9 +56,9 @@ ahc_echo (void *cls,
56 /* always to busy for POST requests */ 56 /* always to busy for POST requests */
57 if (0 == strcmp (method, "POST")) 57 if (0 == strcmp (method, "POST"))
58 { 58 {
59 response = MHD_create_response_from_data (strlen (BUSYPAGE), 59 response = MHD_create_response_from_buffer (strlen (BUSYPAGE),
60 (void *) BUSYPAGE, MHD_NO, 60 (void *) BUSYPAGE,
61 MHD_NO); 61 MHD_RESPMEM_PERSISTENT);
62 ret = 62 ret =
63 MHD_queue_response (connection, MHD_HTTP_SERVICE_UNAVAILABLE, 63 MHD_queue_response (connection, MHD_HTTP_SERVICE_UNAVAILABLE,
64 response); 64 response);
@@ -68,8 +68,9 @@ ahc_echo (void *cls,
68 } 68 }
69 69
70 *ptr = NULL; /* reset when done */ 70 *ptr = NULL; /* reset when done */
71 response = MHD_create_response_from_data (strlen (me), 71 response = MHD_create_response_from_buffer (strlen (me),
72 (void *) me, MHD_NO, MHD_NO); 72 (void *) me,
73 MHD_RESPMEM_PERSISTENT);
73 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 74 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
74 MHD_destroy_response (response); 75 MHD_destroy_response (response);
75 return ret; 76 return ret;
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index f123969b..c63e43bb 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1199,6 +1199,8 @@ struct MHD_Response *MHD_create_response_from_callback (uint64_t size,
1199 MHD_ContentReaderFreeCallback 1199 MHD_ContentReaderFreeCallback
1200 crfc); 1200 crfc);
1201 1201
1202
1203
1202/** 1204/**
1203 * Create a response object. The response object can be extended with 1205 * Create a response object. The response object can be extended with
1204 * header information and then be used any number of times. 1206 * header information and then be used any number of times.
@@ -1210,6 +1212,7 @@ struct MHD_Response *MHD_create_response_from_callback (uint64_t size,
1210 * right away, the data maybe released anytime after 1212 * right away, the data maybe released anytime after
1211 * this call returns 1213 * this call returns
1212 * @return NULL on error (i.e. invalid arguments, out of memory) 1214 * @return NULL on error (i.e. invalid arguments, out of memory)
1215 * @deprecated use MHD_create_response_from_buffer instead
1213 */ 1216 */
1214struct MHD_Response *MHD_create_response_from_data (size_t size, 1217struct MHD_Response *MHD_create_response_from_data (size_t size,
1215 void *data, 1218 void *data,
@@ -1218,12 +1221,59 @@ struct MHD_Response *MHD_create_response_from_data (size_t size,
1218 1221
1219 1222
1220/** 1223/**
1224 * Specification for how MHD should treat the memory buffer
1225 * given for the response.
1226 */
1227enum MHD_ResponseMemoryMode {
1228
1229 /**
1230 * Buffer is a persistent (static/global) buffer that won't change
1231 * for at least the lifetime of the response, MHD should just use
1232 * it, not free it, not copy it, just keep an alias to it.
1233 */
1234 MHD_RESPMEM_PERSISTENT,
1235
1236 /**
1237 * Buffer is heap-allocated with 'malloc' (or equivalent) and
1238 * should be freed by MHD after processing the response has
1239 * concluded (response reference counter reaches zero).
1240 */
1241 MHD_RESPMEM_MUST_FREE,
1242
1243 /**
1244 * Buffer is in transient memory, but not on the heap (for example,
1245 * on the stack or non-malloc allocated) and only valid during the
1246 * call to 'MHD_create_response_from_buffer'. MHD must make its
1247 * own private copy of the data for processing.
1248 */
1249 MHD_RESPMEM_MUST_COPY
1250
1251};
1252
1253
1254/**
1255 * Create a response object. The response object can be extended with
1256 * header information and then be used any number of times.
1257 *
1258 * @param size size of the data portion of the response
1259 * @param buffer size bytes containing the response's data portion
1260 * @param mode flags for buffer management
1261 * @return NULL on error (i.e. invalid arguments, out of memory)
1262 */
1263struct MHD_Response *
1264MHD_create_response_from_buffer (size_t size,
1265 void *buffer,
1266 enum MHD_ResponseMemoryMode mode);
1267
1268
1269/**
1221 * Create a response object. The response object can be extended with 1270 * Create a response object. The response object can be extended with
1222 * header information and then be used any number of times. 1271 * header information and then be used any number of times.
1223 * 1272 *
1224 * @param size size of the data portion of the response 1273 * @param size size of the data portion of the response
1225 * @param fd file descriptor referring to a file on disk with the data; will be closed when response is destroyed 1274 * @param fd file descriptor referring to a file on disk with the data; will be closed when response is destroyed
1226 * @return NULL on error (i.e. invalid arguments, out of memory) 1275 * @return NULL on error (i.e. invalid arguments, out of memory)
1276 * @deprecated use MHD_create_response_from_fd_at_offset instead
1227 */ 1277 */
1228struct MHD_Response *MHD_create_response_from_fd (size_t size, 1278struct MHD_Response *MHD_create_response_from_fd (size_t size,
1229 int fd); 1279 int fd);
diff --git a/src/testcurl/daemontest_digestauth.c b/src/testcurl/daemontest_digestauth.c
index 67006272..2fa9f49e 100644
--- a/src/testcurl/daemontest_digestauth.c
+++ b/src/testcurl/daemontest_digestauth.c
@@ -81,9 +81,9 @@ ahc_echo (void *cls,
81 if ( (username == NULL) || 81 if ( (username == NULL) ||
82 (0 != strcmp (username, "testuser")) ) 82 (0 != strcmp (username, "testuser")) )
83 { 83 {
84 response = MHD_create_response_from_data(strlen (DENIED), 84 response = MHD_create_response_from_buffer(strlen (DENIED),
85 DENIED, 85 DENIED,
86 MHD_NO, MHD_NO); 86 MHD_RESPMEM_PERSISTENT);
87 ret = MHD_queue_auth_fail_response(connection, realm, 87 ret = MHD_queue_auth_fail_response(connection, realm,
88 OPAQUE, 88 OPAQUE,
89 response, 89 response,
@@ -99,9 +99,9 @@ ahc_echo (void *cls,
99 if ( (ret == MHD_INVALID_NONCE) || 99 if ( (ret == MHD_INVALID_NONCE) ||
100 (ret == MHD_NO) ) 100 (ret == MHD_NO) )
101 { 101 {
102 response = MHD_create_response_from_data(strlen (DENIED), 102 response = MHD_create_response_from_buffer(strlen (DENIED),
103 DENIED, 103 DENIED,
104 MHD_NO, MHD_NO); 104 MHD_RESPMEM_PERSISTENT);
105 if (NULL == response) 105 if (NULL == response)
106 return MHD_NO; 106 return MHD_NO;
107 ret = MHD_queue_auth_fail_response(connection, realm, 107 ret = MHD_queue_auth_fail_response(connection, realm,
@@ -111,8 +111,8 @@ ahc_echo (void *cls,
111 MHD_destroy_response(response); 111 MHD_destroy_response(response);
112 return ret; 112 return ret;
113 } 113 }
114 response = MHD_create_response_from_data(strlen(PAGE), PAGE, 114 response = MHD_create_response_from_buffer(strlen(PAGE), PAGE,
115 MHD_NO, MHD_NO); 115 MHD_RESPMEM_PERSISTENT);
116 ret = MHD_queue_response(connection, MHD_HTTP_OK, response); 116 ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
117 MHD_destroy_response(response); 117 MHD_destroy_response(response);
118 return ret; 118 return ret;
diff --git a/src/testcurl/daemontest_get.c b/src/testcurl/daemontest_get.c
index 9303e54c..c8e47cd5 100644
--- a/src/testcurl/daemontest_get.c
+++ b/src/testcurl/daemontest_get.c
@@ -85,8 +85,9 @@ ahc_echo (void *cls,
85 return MHD_YES; 85 return MHD_YES;
86 } 86 }
87 *unused = NULL; 87 *unused = NULL;
88 response = MHD_create_response_from_data (strlen (url), 88 response = MHD_create_response_from_buffer (strlen (url),
89 (void *) url, MHD_NO, MHD_YES); 89 (void *) url,
90 MHD_RESPMEM_MUST_COPY);
90 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 91 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
91 MHD_destroy_response (response); 92 MHD_destroy_response (response);
92 if (ret == MHD_NO) 93 if (ret == MHD_NO)
diff --git a/src/testcurl/daemontest_iplimit.c b/src/testcurl/daemontest_iplimit.c
index 93e6b06c..6b714e92 100644
--- a/src/testcurl/daemontest_iplimit.c
+++ b/src/testcurl/daemontest_iplimit.c
@@ -80,8 +80,9 @@ ahc_echo (void *cls,
80 return MHD_YES; 80 return MHD_YES;
81 } 81 }
82 *unused = NULL; 82 *unused = NULL;
83 response = MHD_create_response_from_data (strlen (url), 83 response = MHD_create_response_from_buffer (strlen (url),
84 (void *) url, MHD_NO, MHD_YES); 84 (void *) url,
85 MHD_RESPMEM_MUST_COPY);
85 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 86 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
86 MHD_destroy_response (response); 87 MHD_destroy_response (response);
87 if (ret == MHD_NO) 88 if (ret == MHD_NO)
diff --git a/src/testcurl/daemontest_large_put.c b/src/testcurl/daemontest_large_put.c
index 6492a48c..3767f703 100644
--- a/src/testcurl/daemontest_large_put.c
+++ b/src/testcurl/daemontest_large_put.c
@@ -122,8 +122,9 @@ ahc_echo (void *cls,
122 *done = 1; 122 *done = 1;
123 return MHD_YES; 123 return MHD_YES;
124 } 124 }
125 response = MHD_create_response_from_data (strlen (url), 125 response = MHD_create_response_from_buffer (strlen (url),
126 (void *) url, MHD_NO, MHD_YES); 126 (void *) url,
127 MHD_RESPMEM_MUST_COPY);
127 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 128 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
128 MHD_destroy_response (response); 129 MHD_destroy_response (response);
129 return ret; 130 return ret;
diff --git a/src/testcurl/daemontest_long_header.c b/src/testcurl/daemontest_long_header.c
index 28b34117..33f2f292 100644
--- a/src/testcurl/daemontest_long_header.c
+++ b/src/testcurl/daemontest_long_header.c
@@ -79,8 +79,9 @@ ahc_echo (void *cls,
79 79
80 if (0 != strcmp (me, method)) 80 if (0 != strcmp (me, method))
81 return MHD_NO; /* unexpected method */ 81 return MHD_NO; /* unexpected method */
82 response = MHD_create_response_from_data (strlen (url), 82 response = MHD_create_response_from_buffer (strlen (url),
83 (void *) url, MHD_NO, MHD_YES); 83 (void *) url,
84 MHD_RESPMEM_MUST_COPY);
84 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 85 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
85 MHD_destroy_response (response); 86 MHD_destroy_response (response);
86 return ret; 87 return ret;
diff --git a/src/testcurl/daemontest_parse_cookies.c b/src/testcurl/daemontest_parse_cookies.c
index bfa8f860..16e0aecd 100644
--- a/src/testcurl/daemontest_parse_cookies.c
+++ b/src/testcurl/daemontest_parse_cookies.c
@@ -95,8 +95,9 @@ ahc_echo (void *cls,
95 hdr = MHD_lookup_connection_value (connection, MHD_COOKIE_KIND, "name4"); 95 hdr = MHD_lookup_connection_value (connection, MHD_COOKIE_KIND, "name4");
96 if ((hdr == NULL) || (0 != strcmp (hdr, "var4 with spaces"))) 96 if ((hdr == NULL) || (0 != strcmp (hdr, "var4 with spaces")))
97 abort (); 97 abort ();
98 response = MHD_create_response_from_data (strlen (url), 98 response = MHD_create_response_from_buffer (strlen (url),
99 (void *) url, MHD_NO, MHD_YES); 99 (void *) url,
100 MHD_RESPMEM_PERSISTENT);
100 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 101 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
101 MHD_destroy_response (response); 102 MHD_destroy_response (response);
102 if (ret == MHD_NO) 103 if (ret == MHD_NO)
diff --git a/src/testcurl/daemontest_post.c b/src/testcurl/daemontest_post.c
index c6233925..ba682cf5 100644
--- a/src/testcurl/daemontest_post.c
+++ b/src/testcurl/daemontest_post.c
@@ -113,9 +113,9 @@ ahc_echo (void *cls,
113 MHD_post_process (pp, upload_data, *upload_data_size); 113 MHD_post_process (pp, upload_data, *upload_data_size);
114 if ((eok == 3) && (0 == *upload_data_size)) 114 if ((eok == 3) && (0 == *upload_data_size))
115 { 115 {
116 response = MHD_create_response_from_data (strlen (url), 116 response = MHD_create_response_from_buffer (strlen (url),
117 (void *) url, 117 (void *) url,
118 MHD_NO, MHD_YES); 118 MHD_RESPMEM_MUST_COPY);
119 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 119 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
120 MHD_destroy_response (response); 120 MHD_destroy_response (response);
121 MHD_destroy_post_processor (pp); 121 MHD_destroy_post_processor (pp);
@@ -432,7 +432,8 @@ ahc_cancel (void *cls,
432 { 432 {
433 *unused = "wibble"; 433 *unused = "wibble";
434 /* We don't want the body. Send a 500. */ 434 /* We don't want the body. Send a 500. */
435 response = MHD_create_response_from_data(0, NULL, 0, 0); 435 response = MHD_create_response_from_buffer (0, NULL,
436 MHD_RESPMEM_PERSISTENT);
436 ret = MHD_queue_response(connection, 500, response); 437 ret = MHD_queue_response(connection, 500, response);
437 if (ret != MHD_YES) 438 if (ret != MHD_YES)
438 fprintf(stderr, "Failed to queue response\n"); 439 fprintf(stderr, "Failed to queue response\n");
diff --git a/src/testcurl/daemontest_post_loop.c b/src/testcurl/daemontest_post_loop.c
index b1e1ab3f..f241744a 100644
--- a/src/testcurl/daemontest_post_loop.c
+++ b/src/testcurl/daemontest_post_loop.c
@@ -83,7 +83,8 @@ ahc_echo (void *cls,
83 { 83 {
84 if (*mptr != &marker) 84 if (*mptr != &marker)
85 abort (); 85 abort ();
86 response = MHD_create_response_from_data (2, "OK", MHD_NO, MHD_NO); 86 response = MHD_create_response_from_buffer (2, "OK",
87 MHD_RESPMEM_PERSISTENT);
87 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 88 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
88 MHD_destroy_response (response); 89 MHD_destroy_response (response);
89 *mptr = NULL; 90 *mptr = NULL;
diff --git a/src/testcurl/daemontest_postform.c b/src/testcurl/daemontest_postform.c
index a1e29f69..545250ec 100644
--- a/src/testcurl/daemontest_postform.c
+++ b/src/testcurl/daemontest_postform.c
@@ -116,9 +116,9 @@ ahc_echo (void *cls,
116 MHD_post_process (pp, upload_data, *upload_data_size); 116 MHD_post_process (pp, upload_data, *upload_data_size);
117 if ((eok == 3) && (0 == *upload_data_size)) 117 if ((eok == 3) && (0 == *upload_data_size))
118 { 118 {
119 response = MHD_create_response_from_data (strlen (url), 119 response = MHD_create_response_from_buffer (strlen (url),
120 (void *) url, 120 (void *) url,
121 MHD_NO, MHD_YES); 121 MHD_RESPMEM_MUST_COPY);
122 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 122 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
123 MHD_destroy_response (response); 123 MHD_destroy_response (response);
124 MHD_destroy_post_processor (pp); 124 MHD_destroy_post_processor (pp);
diff --git a/src/testcurl/daemontest_process_arguments.c b/src/testcurl/daemontest_process_arguments.c
index 23fe78e3..0e7edbf7 100644
--- a/src/testcurl/daemontest_process_arguments.c
+++ b/src/testcurl/daemontest_process_arguments.c
@@ -88,8 +88,9 @@ ahc_echo (void *cls,
88 MHD_GET_ARGUMENT_KIND, "hash"); 88 MHD_GET_ARGUMENT_KIND, "hash");
89 if ((hdr == NULL) || (0 != strcmp (hdr, "#"))) 89 if ((hdr == NULL) || (0 != strcmp (hdr, "#")))
90 abort (); 90 abort ();
91 response = MHD_create_response_from_data (strlen (url), 91 response = MHD_create_response_from_buffer (strlen (url),
92 (void *) url, MHD_NO, MHD_YES); 92 (void *) url,
93 MHD_RESPMEM_MUST_COPY);
93 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 94 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
94 MHD_destroy_response (response); 95 MHD_destroy_response (response);
95 if (ret == MHD_NO) 96 if (ret == MHD_NO)
diff --git a/src/testcurl/daemontest_process_headers.c b/src/testcurl/daemontest_process_headers.c
index cd4bd68c..fc0c5aef 100644
--- a/src/testcurl/daemontest_process_headers.c
+++ b/src/testcurl/daemontest_process_headers.c
@@ -115,8 +115,9 @@ ahc_echo (void *cls,
115 if ((hdr == NULL) || (0 != strcmp (hdr, "NowPresent"))) 115 if ((hdr == NULL) || (0 != strcmp (hdr, "NowPresent")))
116 abort (); 116 abort ();
117 117
118 response = MHD_create_response_from_data (strlen (url), 118 response = MHD_create_response_from_buffer (strlen (url),
119 (void *) url, MHD_NO, MHD_YES); 119 (void *) url,
120 MHD_RESPMEM_MUST_COPY);
120 MHD_add_response_header (response, "MyHeader", "MyValue"); 121 MHD_add_response_header (response, "MyHeader", "MyValue");
121 hdr = MHD_get_response_header (response, "MyHeader"); 122 hdr = MHD_get_response_header (response, "MyHeader");
122 if (0 != strcmp ("MyValue", hdr)) 123 if (0 != strcmp ("MyValue", hdr))
diff --git a/src/testcurl/daemontest_put.c b/src/testcurl/daemontest_put.c
index 76e96320..1899e434 100644
--- a/src/testcurl/daemontest_put.c
+++ b/src/testcurl/daemontest_put.c
@@ -102,8 +102,8 @@ ahc_echo (void *cls,
102 *done = 1; 102 *done = 1;
103 return MHD_YES; 103 return MHD_YES;
104 } 104 }
105 response = MHD_create_response_from_data (strlen (url), 105 response = MHD_create_response_from_buffer (strlen (url), (void*) url,
106 (void *) url, MHD_NO, MHD_YES); 106 MHD_RESPMEM_MUST_COPY);
107 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 107 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
108 MHD_destroy_response (response); 108 MHD_destroy_response (response);
109 return ret; 109 return ret;
diff --git a/src/testcurl/daemontest_put_chunked.c b/src/testcurl/daemontest_put_chunked.c
index 3fa1f092..46c17330 100644
--- a/src/testcurl/daemontest_put_chunked.c
+++ b/src/testcurl/daemontest_put_chunked.c
@@ -111,8 +111,9 @@ ahc_echo (void *cls,
111#endif 111#endif
112 return MHD_YES; 112 return MHD_YES;
113 } 113 }
114 response = MHD_create_response_from_data (strlen (url), 114 response = MHD_create_response_from_buffer (strlen (url),
115 (void *) url, MHD_NO, MHD_YES); 115 (void *) url,
116 MHD_RESPMEM_MUST_COPY);
116 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 117 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
117 MHD_destroy_response (response); 118 MHD_destroy_response (response);
118 return ret; 119 return ret;
diff --git a/src/testcurl/daemontest_termination.c b/src/testcurl/daemontest_termination.c
index 3f25916c..2d6ab93b 100644
--- a/src/testcurl/daemontest_termination.c
+++ b/src/testcurl/daemontest_termination.c
@@ -65,7 +65,8 @@ connection_handler (void *cls,
65 } 65 }
66 66
67 struct MHD_Response *response = 67 struct MHD_Response *response =
68 MHD_create_response_from_data (strlen ("Response"), "Response", 0, 0); 68 MHD_create_response_from_buffer (strlen ("Response"), "Response",
69 MHD_RESPMEM_PERSISTENT);
69 int ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 70 int ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
70 MHD_destroy_response (response); 71 MHD_destroy_response (response);
71 72
diff --git a/src/testcurl/daemontest_timeout.c b/src/testcurl/daemontest_timeout.c
index 6032d78d..f3d82243 100644
--- a/src/testcurl/daemontest_timeout.c
+++ b/src/testcurl/daemontest_timeout.c
@@ -113,8 +113,9 @@ ahc_echo (void *cls,
113 *done = 1; 113 *done = 1;
114 return MHD_YES; 114 return MHD_YES;
115 } 115 }
116 response = MHD_create_response_from_data (strlen (url), 116 response = MHD_create_response_from_buffer (strlen (url),
117 (void *) url, MHD_NO, MHD_YES); 117 (void *) url,
118 MHD_RESPMEM_MUST_COPY);
118 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 119 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
119 MHD_destroy_response (response); 120 MHD_destroy_response (response);
120 return ret; 121 return ret;
diff --git a/src/testcurl/https/mhds_get_test_select.c b/src/testcurl/https/mhds_get_test_select.c
index b31db5cc..1ddab1d3 100644
--- a/src/testcurl/https/mhds_get_test_select.c
+++ b/src/testcurl/https/mhds_get_test_select.c
@@ -61,8 +61,9 @@ ahc_echo (void *cls,
61 return MHD_YES; 61 return MHD_YES;
62 } 62 }
63 *unused = NULL; 63 *unused = NULL;
64 response = MHD_create_response_from_data (strlen (url), 64 response = MHD_create_response_from_buffer (strlen (url),
65 (void *) url, MHD_NO, MHD_YES); 65 (void *) url,
66 MHD_RESPMEM_MUST_COPY);
66 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 67 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
67 MHD_destroy_response (response); 68 MHD_destroy_response (response);
68 if (ret == MHD_NO) 69 if (ret == MHD_NO)
diff --git a/src/testcurl/https/mhds_session_info_test.c b/src/testcurl/https/mhds_session_info_test.c
index a5ff42f8..4f8c67d2 100644
--- a/src/testcurl/https/mhds_session_info_test.c
+++ b/src/testcurl/https/mhds_session_info_test.c
@@ -78,9 +78,9 @@ query_session_ahc (void *cls, struct MHD_Connection *connection,
78 return -1; 78 return -1;
79 } 79 }
80 80
81 response = MHD_create_response_from_data (strlen (EMPTY_PAGE), 81 response = MHD_create_response_from_buffer (strlen (EMPTY_PAGE),
82 (void *) EMPTY_PAGE, 82 (void *) EMPTY_PAGE,
83 MHD_NO, MHD_NO); 83 MHD_RESPMEM_PERSISTENT);
84 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 84 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
85 MHD_destroy_response (response); 85 MHD_destroy_response (response);
86 return ret; 86 return ret;
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c
index 1b63862c..e990312f 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -178,9 +178,9 @@ http_ahc (void *cls, struct MHD_Connection *connection,
178 return MHD_YES; 178 return MHD_YES;
179 } 179 }
180 *ptr = NULL; /* reset when done */ 180 *ptr = NULL; /* reset when done */
181 response = MHD_create_response_from_data (strlen (test_data), 181 response = MHD_create_response_from_buffer (strlen (test_data),
182 (void *) test_data, 182 (void *) test_data,
183 MHD_NO, MHD_NO); 183 MHD_RESPMEM_PERSISTENT);
184 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 184 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
185 MHD_destroy_response (response); 185 MHD_destroy_response (response);
186 return ret; 186 return ret;
diff --git a/src/testzzuf/daemontest_get.c b/src/testzzuf/daemontest_get.c
index ed0e7719..4aed7fb5 100644
--- a/src/testzzuf/daemontest_get.c
+++ b/src/testzzuf/daemontest_get.c
@@ -81,8 +81,9 @@ ahc_echo (void *cls,
81 return MHD_YES; 81 return MHD_YES;
82 } 82 }
83 *unused = NULL; 83 *unused = NULL;
84 response = MHD_create_response_from_data (strlen (url), 84 response = MHD_create_response_from_buffer (strlen (url),
85 (void *) url, MHD_NO, MHD_YES); 85 (void *) url,
86 MHD_RESPMEM_MUST_COPY);
86 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 87 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
87 MHD_destroy_response (response); 88 MHD_destroy_response (response);
88 if (ret == MHD_NO) 89 if (ret == MHD_NO)
diff --git a/src/testzzuf/daemontest_large_put.c b/src/testzzuf/daemontest_large_put.c
index ff616555..10fc8b06 100644
--- a/src/testzzuf/daemontest_large_put.c
+++ b/src/testzzuf/daemontest_large_put.c
@@ -119,8 +119,9 @@ ahc_echo (void *cls,
119 *done = 1; 119 *done = 1;
120 return MHD_YES; 120 return MHD_YES;
121 } 121 }
122 response = MHD_create_response_from_data (strlen (url), 122 response = MHD_create_response_from_buffer (strlen (url),
123 (void *) url, MHD_NO, MHD_YES); 123 (void *) url,
124 MHD_RESPMEM_MUST_COPY);
124 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 125 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
125 MHD_destroy_response (response); 126 MHD_destroy_response (response);
126 return ret; 127 return ret;
diff --git a/src/testzzuf/daemontest_long_header.c b/src/testzzuf/daemontest_long_header.c
index 99b9e5e3..d285768f 100644
--- a/src/testzzuf/daemontest_long_header.c
+++ b/src/testzzuf/daemontest_long_header.c
@@ -81,8 +81,9 @@ ahc_echo (void *cls,
81 81
82 if (0 != strcmp (me, method)) 82 if (0 != strcmp (me, method))
83 return MHD_NO; /* unexpected method */ 83 return MHD_NO; /* unexpected method */
84 response = MHD_create_response_from_data (strlen (url), 84 response = MHD_create_response_from_buffer (strlen (url),
85 (void *) url, MHD_NO, MHD_YES); 85 (void *) url,
86 MHD_RESPMEM_MUST_COPY);
86 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 87 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
87 MHD_destroy_response (response); 88 MHD_destroy_response (response);
88 return ret; 89 return ret;
diff --git a/src/testzzuf/daemontest_post.c b/src/testzzuf/daemontest_post.c
index 6323a5eb..66077b4f 100644
--- a/src/testzzuf/daemontest_post.c
+++ b/src/testzzuf/daemontest_post.c
@@ -115,9 +115,9 @@ ahc_echo (void *cls,
115 MHD_post_process (pp, upload_data, *upload_data_size); 115 MHD_post_process (pp, upload_data, *upload_data_size);
116 if ((eok == 3) && (0 == *upload_data_size)) 116 if ((eok == 3) && (0 == *upload_data_size))
117 { 117 {
118 response = MHD_create_response_from_data (strlen (url), 118 response = MHD_create_response_from_buffer (strlen (url),
119 (void *) url, 119 (void *) url,
120 MHD_NO, MHD_YES); 120 MHD_RESPMEM_MUST_COPY);
121 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 121 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
122 MHD_destroy_response (response); 122 MHD_destroy_response (response);
123 MHD_destroy_post_processor (pp); 123 MHD_destroy_post_processor (pp);
diff --git a/src/testzzuf/daemontest_postform.c b/src/testzzuf/daemontest_postform.c
index 817b0bc7..873c7fef 100644
--- a/src/testzzuf/daemontest_postform.c
+++ b/src/testzzuf/daemontest_postform.c
@@ -120,9 +120,9 @@ ahc_echo (void *cls,
120 MHD_post_process (pp, upload_data, *upload_data_size); 120 MHD_post_process (pp, upload_data, *upload_data_size);
121 if ((eok == 3) && (0 == *upload_data_size)) 121 if ((eok == 3) && (0 == *upload_data_size))
122 { 122 {
123 response = MHD_create_response_from_data (strlen (url), 123 response = MHD_create_response_from_buffer (strlen (url),
124 (void *) url, 124 (void *) url,
125 MHD_NO, MHD_YES); 125 MHD_RESPMEM_MUST_COPY);
126 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 126 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
127 MHD_destroy_response (response); 127 MHD_destroy_response (response);
128 MHD_destroy_post_processor (pp); 128 MHD_destroy_post_processor (pp);
diff --git a/src/testzzuf/daemontest_put.c b/src/testzzuf/daemontest_put.c
index c759e055..c658c39c 100644
--- a/src/testzzuf/daemontest_put.c
+++ b/src/testzzuf/daemontest_put.c
@@ -105,8 +105,9 @@ ahc_echo (void *cls,
105 *done = 1; 105 *done = 1;
106 return MHD_YES; 106 return MHD_YES;
107 } 107 }
108 response = MHD_create_response_from_data (strlen (url), 108 response = MHD_create_response_from_buffer (strlen (url),
109 (void *) url, MHD_NO, MHD_YES); 109 (void *) url,
110 MHD_RESPMEM_MUST_COPY);
110 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 111 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
111 MHD_destroy_response (response); 112 MHD_destroy_response (response);
112 return ret; 113 return ret;
diff --git a/src/testzzuf/daemontest_put_chunked.c b/src/testzzuf/daemontest_put_chunked.c
index d49478ee..47d0f0ba 100644
--- a/src/testzzuf/daemontest_put_chunked.c
+++ b/src/testzzuf/daemontest_put_chunked.c
@@ -111,8 +111,9 @@ ahc_echo (void *cls,
111#endif 111#endif
112 return MHD_YES; 112 return MHD_YES;
113 } 113 }
114 response = MHD_create_response_from_data (strlen (url), 114 response = MHD_create_response_from_buffer (strlen (url),
115 (void *) url, MHD_NO, MHD_YES); 115 (void *) url,
116 MHD_RESPMEM_MUST_COPY);
116 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 117 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
117 MHD_destroy_response (response); 118 MHD_destroy_response (response);
118 return ret; 119 return ret;