[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14107 - in libmicrohttpd: . doc doc/chapters doc/examples
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14107 - in libmicrohttpd: . doc doc/chapters doc/examples src/daemon src/examples src/include src/testcurl src/testcurl/https src/testzzuf |
Date: |
Tue, 4 Jan 2011 13:40:03 +0100 |
Author: grothoff
Date: 2011-01-04 13:40:03 +0100 (Tue, 04 Jan 2011)
New Revision: 14107
Modified:
libmicrohttpd/ChangeLog
libmicrohttpd/doc/chapters/basicauthentication.inc
libmicrohttpd/doc/chapters/hellobrowser.inc
libmicrohttpd/doc/chapters/largerpost.inc
libmicrohttpd/doc/chapters/responseheaders.inc
libmicrohttpd/doc/examples/basicauthentication.c
libmicrohttpd/doc/examples/hellobrowser.c
libmicrohttpd/doc/examples/largepost.c
libmicrohttpd/doc/examples/responseheaders.c
libmicrohttpd/doc/examples/simplepost.c
libmicrohttpd/doc/examples/tlsauthentication.c
libmicrohttpd/doc/microhttpd.texi
libmicrohttpd/src/daemon/connection.c
libmicrohttpd/src/daemon/response.c
libmicrohttpd/src/examples/authorization_example.c
libmicrohttpd/src/examples/digest_auth_example.c
libmicrohttpd/src/examples/fileserver_example.c
libmicrohttpd/src/examples/fileserver_example_dirs.c
libmicrohttpd/src/examples/fileserver_example_external_select.c
libmicrohttpd/src/examples/https_fileserver_example.c
libmicrohttpd/src/examples/minimal_example.c
libmicrohttpd/src/examples/querystring_example.c
libmicrohttpd/src/examples/refuse_post_example.c
libmicrohttpd/src/include/microhttpd.h
libmicrohttpd/src/testcurl/daemontest_digestauth.c
libmicrohttpd/src/testcurl/daemontest_get.c
libmicrohttpd/src/testcurl/daemontest_iplimit.c
libmicrohttpd/src/testcurl/daemontest_large_put.c
libmicrohttpd/src/testcurl/daemontest_long_header.c
libmicrohttpd/src/testcurl/daemontest_parse_cookies.c
libmicrohttpd/src/testcurl/daemontest_post.c
libmicrohttpd/src/testcurl/daemontest_post_loop.c
libmicrohttpd/src/testcurl/daemontest_postform.c
libmicrohttpd/src/testcurl/daemontest_process_arguments.c
libmicrohttpd/src/testcurl/daemontest_process_headers.c
libmicrohttpd/src/testcurl/daemontest_put.c
libmicrohttpd/src/testcurl/daemontest_put_chunked.c
libmicrohttpd/src/testcurl/daemontest_termination.c
libmicrohttpd/src/testcurl/daemontest_timeout.c
libmicrohttpd/src/testcurl/https/mhds_get_test_select.c
libmicrohttpd/src/testcurl/https/mhds_session_info_test.c
libmicrohttpd/src/testcurl/https/tls_test_common.c
libmicrohttpd/src/testzzuf/daemontest_get.c
libmicrohttpd/src/testzzuf/daemontest_large_put.c
libmicrohttpd/src/testzzuf/daemontest_long_header.c
libmicrohttpd/src/testzzuf/daemontest_post.c
libmicrohttpd/src/testzzuf/daemontest_postform.c
libmicrohttpd/src/testzzuf/daemontest_put.c
libmicrohttpd/src/testzzuf/daemontest_put_chunked.c
Log:
introducing MHD_create_response_from_buffer, deprecating
MHD_create_response_from_data
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2011-01-03 16:00:02 UTC (rev 14106)
+++ libmicrohttpd/ChangeLog 2011-01-04 12:40:03 UTC (rev 14107)
@@ -1,3 +1,8 @@
+Tue Jan 4 13:07:21 CET 2011
+ Added MHD_create_response_from_buffer, deprecating
+ MHD_create_response_from_data. Deprecating
+ MHD_create_response_from_fd as well. -CG
+
Sun Dec 26 00:02:15 CET 2010
Releasing libmicrohttpd 0.9.4. -CG
Modified: libmicrohttpd/doc/chapters/basicauthentication.inc
===================================================================
--- libmicrohttpd/doc/chapters/basicauthentication.inc 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/doc/chapters/basicauthentication.inc 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -107,8 +107,8 @@
{
const char *page = "<html><body>Go away.</body></html>";
response =
- MHD_create_response_from_data (strlen (page), (void *) page, MHD_NO,
- MHD_NO);
+ MHD_create_response_from_buffer (strlen (page), (void *) page,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_basic_auth_fail_response (connection,
"my realm",
response);
@@ -117,8 +117,8 @@
{
const char *page = "<html><body>A secret.</body></html>";
response =
- MHD_create_response_from_data (strlen (page), (void *) page, MHD_NO,
- MHD_NO);
+ MHD_create_response_from_buffer (strlen (page), (void *) page,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
}
MHD_destroy_response (response);
Modified: libmicrohttpd/doc/chapters/hellobrowser.inc
===================================================================
--- libmicrohttpd/doc/chapters/hellobrowser.inc 2011-01-03 16:00:02 UTC (rev
14106)
+++ libmicrohttpd/doc/chapters/hellobrowser.inc 2011-01-04 12:40:03 UTC (rev
14107)
@@ -54,7 +54,7 @@
just sent the answer string "as is". Instead, it has to be wrapped with
additional information stored in so-called headers and footers. Most of the
work in this area is done by the library for us---we
just have to ask. Our reply string packed in the necessary layers will be
called a "response".
To obtain such a response we hand our data (the reply--string) and its size
over to the
address@hidden function. The last two parameters basically tell @emph{MHD}
address@hidden function. The last two parameters basically tell @emph{MHD}
that we do not want it to dispose the message data for us when it has been
sent and there also needs
no internal copy to be done because the @emph{constant} string won't change
anyway.
@@ -62,8 +62,8 @@
struct MHD_Response *response;
int ret;
- response = MHD_create_response_from_data (strlen (page),
- (void*) page, MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (page),
+ (void*) page,
MHD_RESPMEM_PERSISTENT);
@end verbatim
Modified: libmicrohttpd/doc/chapters/largerpost.inc
===================================================================
--- libmicrohttpd/doc/chapters/largerpost.inc 2011-01-03 16:00:02 UTC (rev
14106)
+++ libmicrohttpd/doc/chapters/largerpost.inc 2011-01-04 12:40:03 UTC (rev
14107)
@@ -67,8 +67,8 @@
int ret;
struct MHD_Response *response;
- response = MHD_create_response_from_data (strlen (page), (void*) page,
- MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (page), (void*) page,
+ MHD_RESPMEM_MUST_COPY);
if (!response) return MHD_NO;
ret = MHD_queue_response (connection, status_code, response);
Modified: libmicrohttpd/doc/chapters/responseheaders.inc
===================================================================
--- libmicrohttpd/doc/chapters/responseheaders.inc 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/doc/chapters/responseheaders.inc 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -63,9 +63,9 @@
"<html><body>An internal server error has occured!\
</body></html>";
response =
- MHD_create_response_from_data (strlen (errorstr),
- (void *) errorstr,
- MHD_NO, MHD_NO);
+ MHD_create_response_from_buffer (strlen (errorstr),
+ (void *) errorstr,
+ MHD_RESPMEM_PERSISTENT);
if (response)
{
ret =
@@ -84,8 +84,8 @@
if (buffer) free(buffer);
- response = MHD_create_response_from_data(strlen(errorstr),
(void*)errorstr,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen(errorstr), (void*)
errorstr,
+ MHD_RESPMEM_PERSISTENT);
if (response)
{
@@ -113,7 +113,7 @@
}
response =
- MHD_create_response_from_fd (fd, sbuf.st_size);
+ MHD_create_response_from_fd_at_offset (fd, sbuf.st_size, 0);
MHD_add_response_header (response, "Content-Type", MIMETYPE);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
Modified: libmicrohttpd/doc/examples/basicauthentication.c
===================================================================
--- libmicrohttpd/doc/examples/basicauthentication.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/doc/examples/basicauthentication.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -40,8 +40,8 @@
{
const char *page = "<html><body>Go away.</body></html>";
response =
- MHD_create_response_from_data (strlen (page), (void *) page, MHD_NO,
- MHD_NO);
+ MHD_create_response_from_buffer (strlen (page), (void *) page,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_basic_auth_fail_response (connection,
"my realm",
response);
@@ -50,8 +50,8 @@
{
const char *page = "<html><body>A secret.</body></html>";
response =
- MHD_create_response_from_data (strlen (page), (void *) page, MHD_NO,
- MHD_NO);
+ MHD_create_response_from_buffer (strlen (page), (void *) page,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
}
MHD_destroy_response (response);
Modified: libmicrohttpd/doc/examples/hellobrowser.c
===================================================================
--- libmicrohttpd/doc/examples/hellobrowser.c 2011-01-03 16:00:02 UTC (rev
14106)
+++ libmicrohttpd/doc/examples/hellobrowser.c 2011-01-04 12:40:03 UTC (rev
14107)
@@ -16,8 +16,8 @@
int ret;
response =
- MHD_create_response_from_data (strlen (page), (void *) page, MHD_NO,
- MHD_NO);
+ MHD_create_response_from_buffer (strlen (page), (void *) page,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
Modified: libmicrohttpd/doc/examples/largepost.c
===================================================================
--- libmicrohttpd/doc/examples/largepost.c 2011-01-03 16:00:02 UTC (rev
14106)
+++ libmicrohttpd/doc/examples/largepost.c 2011-01-04 12:40:03 UTC (rev
14107)
@@ -51,8 +51,8 @@
struct MHD_Response *response;
response =
- MHD_create_response_from_data (strlen (page), (void *) page, MHD_NO,
- MHD_YES);
+ MHD_create_response_from_buffer (strlen (page), (void *) page,
+ MHD_RESPMEM_PERSISTENT);
if (!response)
return MHD_NO;
Modified: libmicrohttpd/doc/examples/responseheaders.c
===================================================================
--- libmicrohttpd/doc/examples/responseheaders.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/doc/examples/responseheaders.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -31,9 +31,9 @@
"<html><body>An internal server error has occured!\
</body></html>";
response =
- MHD_create_response_from_data (strlen (errorstr),
- (void *) errorstr,
- MHD_NO, MHD_NO);
+ MHD_create_response_from_buffer (strlen (errorstr),
+ (void *) errorstr,
+ MHD_RESPMEM_PERSISTENT);
if (response)
{
ret =
@@ -47,7 +47,7 @@
return MHD_NO;
}
response =
- MHD_create_response_from_fd (fd, sbuf.st_size);
+ MHD_create_response_from_fd_at_offset (fd, sbuf.st_size, 0);
MHD_add_response_header (response, "Content-Type", MIMETYPE);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
Modified: libmicrohttpd/doc/examples/simplepost.c
===================================================================
--- libmicrohttpd/doc/examples/simplepost.c 2011-01-03 16:00:02 UTC (rev
14106)
+++ libmicrohttpd/doc/examples/simplepost.c 2011-01-04 12:40:03 UTC (rev
14107)
@@ -40,8 +40,8 @@
response =
- MHD_create_response_from_data (strlen (page), (void *) page, MHD_NO,
- MHD_NO);
+ MHD_create_response_from_buffer (strlen (page), (void *) page,
+ MHD_RESPMEM_PERSISTENT);
if (!response)
return MHD_NO;
Modified: libmicrohttpd/doc/examples/tlsauthentication.c
===================================================================
--- libmicrohttpd/doc/examples/tlsauthentication.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/doc/examples/tlsauthentication.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -113,7 +113,8 @@
char *headervalue;
const char *strbase = "Basic realm=";
- response = MHD_create_response_from_data (0, NULL, MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (0, NULL,
+ MHD_RESPMEM_PERSISTENT);
if (!response)
return MHD_NO;
@@ -186,8 +187,8 @@
const char *page = "<html><body>A secret.</body></html>";
response =
- MHD_create_response_from_data (strlen (page), (void *) page, MHD_NO,
- MHD_NO);
+ MHD_create_response_from_buffer (strlen (page), (void *) page,
+ MHD_RESPMEM_PERSISTENT);
if (!response)
return MHD_NO;
Modified: libmicrohttpd/doc/microhttpd.texi
===================================================================
--- libmicrohttpd/doc/microhttpd.texi 2011-01-03 16:00:02 UTC (rev 14106)
+++ libmicrohttpd/doc/microhttpd.texi 2011-01-04 12:40:03 UTC (rev 14107)
@@ -674,7 +674,32 @@
@end deftp
address@hidden {Enumeration} MHD_ResponseMemoryMode
+The @code{MHD_ResponeMemoryMode} specifies how MHD should treat
+the memory buffer given for the response in
address@hidden
address@hidden @code
address@hidden MHD_RESPMEM_PERSISTENT
+Buffer is a persistent (static/global) buffer that won't change
+for at least the lifetime of the response, MHD should just use
+it, not free it, not copy it, just keep an alias to it.
+
address@hidden MHD_RESPMEM_MUST_FREE
+Buffer is heap-allocated with @code{malloc} (or equivalent) and
+should be freed by MHD after processing the response has
+concluded (response reference counter reaches zero).
+
address@hidden MHD_RESPMEM_MUST_COPY
+Buffer is in transient memory, but not on the heap (for example,
+on the stack or non-malloc allocated) and only valid during the
+call to @code{MHD_create_response_from_buffer}. MHD must make its
+own private copy of the data for processing.
+
address@hidden table
address@hidden deftp
+
+
@deftp {Enumeration} MHD_ConnectionInfoType
Values of this enum are used to specify what information about a
connection is desired.
@@ -1245,7 +1270,7 @@
a @code{MHD_Response} object is allocated:
@example
-struct MHD_Response * response = MHD_create_response_from_data(...);
+struct MHD_Response * response = MHD_create_response_from_buffer(...);
/* here: reference counter = 1 */
@end example
@@ -1312,6 +1337,8 @@
@deftypefun {struct MHD_Response *} MHD_create_response_from_fd (uint64_t
size, int fd)
Create a response object. The response object can be extended with
header information and then it can be used any number of times.
+Function is deprecated, use @code{MHD_create_response_from_fd_at_offset}
+instead (with an offset of zero).
@table @var
@item size
@@ -1352,9 +1379,34 @@
@end deftypefun
address@hidden {struct MHD_Response *} MHD_create_response_from_buffer (size_t
size, void *data, enum MHD_ResponseMemoryMode mode)
+Create a response object. The response object can be extended with
+header information and then it can be used any number of times.
+
address@hidden @var
address@hidden size
+size of the data portion of the response;
+
address@hidden buffer
+the data itself;
+
address@hidden mode
+memory management options for buffer; use
+MHD_RESPMEM_PERSISTENT if the buffer is static/global memory,
+use MHD_RESPMEM_MUST_FREE if the buffer is heap-allocated and
+should be freed by @mhd{} and MHD_RESPMEM_MUST_COPY if the
+buffer is in transient memory (i.e. on the stack) and must
+be copied by @mhd{};
address@hidden table
+
+Return @mynull{} on error (i.e. invalid arguments, out of memory).
address@hidden deftypefun
+
+
@deftypefun {struct MHD_Response *} MHD_create_response_from_data (size_t
size, void *data, int must_free, int must_copy)
Create a response object. The response object can be extended with
header information and then it can be used any number of times.
+This function is deprecated, use @code{MHD_create_response_from_buffer}
instead.
@table @var
@item size
@@ -1385,8 +1437,8 @@
struct MHD_Connection * connection = ...;
struct MHD_Response * response;
-response = MHD_create_response_from_data(strlen(data), data,
- MHD_NO, MHD_NO);
+response = MHD_create_response_from_buffer (strlen(data), data,
+ MHD_RESPMEM_PERSISTENT);
MHD_queue_response(connection, 404, response);
MHD_destroy_response(response);
@end example
@@ -1599,9 +1651,9 @@
username = MHD_digest_auth_get_username(connection);
if (username == NULL)
@{
- response = MHD_create_response_from_data(strlen (DENIED),
- DENIED,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer(strlen (DENIED),
+ DENIED,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_auth_fail_response(connection, realm,
OPAQUE,
response,
@@ -1617,9 +1669,9 @@
if ( (ret == MHD_INVALID_NONCE) ||
(ret == MHD_NO) )
@{
- response = MHD_create_response_from_data(strlen (DENIED),
- DENIED,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer(strlen (DENIED),
+ DENIED,
+ MHD_RESPMEM_PERSISTENT);
if (NULL == response)
return MHD_NO;
ret = MHD_queue_auth_fail_response(connection, realm,
@@ -1629,8 +1681,8 @@
MHD_destroy_response(response);
return ret;
@}
- response = MHD_create_response_from_data(strlen(PAGE), PAGE,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen(PAGE), PAGE,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
MHD_destroy_response(response);
return ret;
Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c 2011-01-03 16:00:02 UTC (rev
14106)
+++ libmicrohttpd/src/daemon/connection.c 2011-01-04 12:40:03 UTC (rev
14107)
@@ -716,8 +716,9 @@
status_code, message);
#endif
EXTRA_CHECK (connection->response == NULL);
- response = MHD_create_response_from_data (strlen (message),
- (void *) message, MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (message),
+ (void *) message,
+ MHD_RESPMEM_PERSISTENT);
MHD_queue_response (connection, status_code, response);
EXTRA_CHECK (connection->response != NULL);
MHD_destroy_response (response);
@@ -1663,8 +1664,9 @@
#endif
EXTRA_CHECK (connection->response == NULL);
response =
- MHD_create_response_from_data (strlen (REQUEST_LACKS_HOST),
- REQUEST_LACKS_HOST, MHD_NO, MHD_NO);
+ MHD_create_response_from_buffer (strlen (REQUEST_LACKS_HOST),
+ REQUEST_LACKS_HOST,
+ MHD_RESPMEM_PERSISTENT);
MHD_queue_response (connection, MHD_HTTP_BAD_REQUEST, response);
MHD_destroy_response (response);
return;
Modified: libmicrohttpd/src/daemon/response.c
===================================================================
--- libmicrohttpd/src/daemon/response.c 2011-01-03 16:00:02 UTC (rev 14106)
+++ libmicrohttpd/src/daemon/response.c 2011-01-04 12:40:03 UTC (rev 14107)
@@ -352,6 +352,7 @@
* right away, the data maybe released anytime after
* this call returns
* @return NULL on error (i.e. invalid arguments, out of memory)
+ * @deprecated use MHD_create_response_from_buffer instead
*/
struct MHD_Response *
MHD_create_response_from_data (size_t size,
@@ -382,7 +383,7 @@
return NULL;
}
memcpy (tmp, data, size);
- must_free = 1;
+ must_free = MHD_YES;
data = tmp;
}
retVal->crc = NULL;
@@ -395,7 +396,29 @@
return retVal;
}
+
/**
+ * Create a response object. The response object can be extended with
+ * header information and then be used any number of times.
+ *
+ * @param size size of the data portion of the response
+ * @param buffer size bytes containing the response's data portion
+ * @param mode flags for buffer management
+ * @return NULL on error (i.e. invalid arguments, out of memory)
+ */
+struct MHD_Response *
+MHD_create_response_from_buffer (size_t size,
+ void *buffer,
+ enum MHD_ResponseMemoryMode mode)
+{
+ return MHD_create_response_from_data (size,
+ buffer,
+ mode == MHD_RESPMEM_MUST_FREE,
+ mode == MHD_RESPMEM_MUST_COPY);
+}
+
+
+/**
* Destroy a response object and associated resources. Note that
* libmicrohttpd may keep some of the resources around if the response
* is still in the queue for some clients, so the memory may not
Modified: libmicrohttpd/src/examples/authorization_example.c
===================================================================
--- libmicrohttpd/src/examples/authorization_example.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/examples/authorization_example.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -63,17 +63,18 @@
(0 != strcmp (auth, "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")))
{
/* require: "Aladdin" with password "open sesame" */
- response = MHD_create_response_from_data (strlen (DENIED),
- (void *) DENIED, MHD_NO,
- MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (DENIED),
+ (void *) DENIED,
+ MHD_RESPMEM_PERSISTENT);
MHD_add_response_header (response, MHD_HTTP_HEADER_WWW_AUTHENTICATE,
"Basic realm=\"TestRealm\"");
code = MHD_HTTP_UNAUTHORIZED;
}
else
{
- response = MHD_create_response_from_data (strlen (me),
- (void *) me, MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (me),
+ (void *) me,
+ MHD_RESPMEM_PERSISTENT);
code = MHD_HTTP_OK;
}
ret = MHD_queue_response (connection, code, response);
Modified: libmicrohttpd/src/examples/digest_auth_example.c
===================================================================
--- libmicrohttpd/src/examples/digest_auth_example.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/examples/digest_auth_example.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -49,9 +49,9 @@
username = MHD_digest_auth_get_username(connection);
if (username == NULL)
{
- response = MHD_create_response_from_data(strlen (DENIED),
- DENIED,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer(strlen (DENIED),
+ DENIED,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_auth_fail_response(connection, realm,
OPAQUE,
response,
@@ -67,9 +67,9 @@
if ( (ret == MHD_INVALID_NONCE) ||
(ret == MHD_NO) )
{
- response = MHD_create_response_from_data(strlen (DENIED),
- DENIED,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer(strlen (DENIED),
+ DENIED,
+ MHD_RESPMEM_PERSISTENT);
if (NULL == response)
return MHD_NO;
ret = MHD_queue_auth_fail_response(connection, realm,
@@ -79,8 +79,8 @@
MHD_destroy_response(response);
return ret;
}
- response = MHD_create_response_from_data(strlen(PAGE), PAGE,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer(strlen(PAGE), PAGE,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
MHD_destroy_response(response);
return ret;
Modified: libmicrohttpd/src/examples/fileserver_example.c
===================================================================
--- libmicrohttpd/src/examples/fileserver_example.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/examples/fileserver_example.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -75,9 +75,9 @@
file = NULL;
if (file == NULL)
{
- response = MHD_create_response_from_data (strlen (PAGE),
- (void *) PAGE,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (PAGE),
+ (void *) PAGE,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response);
MHD_destroy_response (response);
}
Modified: libmicrohttpd/src/examples/fileserver_example_dirs.c
===================================================================
--- libmicrohttpd/src/examples/fileserver_example_dirs.c 2011-01-03
16:00:02 UTC (rev 14106)
+++ libmicrohttpd/src/examples/fileserver_example_dirs.c 2011-01-04
12:40:03 UTC (rev 14107)
@@ -117,10 +117,9 @@
sizeof (emsg),
"Failed to open directory `.': %s\n",
strerror (errno));
- response = MHD_create_response_from_data (strlen (emsg),
- emsg,
- MHD_NO,
- MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (emsg),
+ emsg,
+ MHD_RESPMEM_MUST_COPY);
if (response == NULL)
return MHD_NO;
ret = MHD_queue_response (connection, MHD_HTTP_SERVICE_UNAVAILABLE,
response);
Modified: libmicrohttpd/src/examples/fileserver_example_external_select.c
===================================================================
--- libmicrohttpd/src/examples/fileserver_example_external_select.c
2011-01-03 16:00:02 UTC (rev 14106)
+++ libmicrohttpd/src/examples/fileserver_example_external_select.c
2011-01-04 12:40:03 UTC (rev 14107)
@@ -76,9 +76,9 @@
file = NULL;
if (file == NULL)
{
- response = MHD_create_response_from_data (strlen (PAGE),
- (void *) PAGE,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (PAGE),
+ (void *) PAGE,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response);
MHD_destroy_response (response);
}
Modified: libmicrohttpd/src/examples/https_fileserver_example.c
===================================================================
--- libmicrohttpd/src/examples/https_fileserver_example.c 2011-01-03
16:00:02 UTC (rev 14106)
+++ libmicrohttpd/src/examples/https_fileserver_example.c 2011-01-04
12:40:03 UTC (rev 14107)
@@ -144,9 +144,9 @@
file = NULL;
if (file == NULL)
{
- response = MHD_create_response_from_data (strlen (EMPTY_PAGE),
- (void *) EMPTY_PAGE,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (EMPTY_PAGE),
+ (void *) EMPTY_PAGE,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response);
MHD_destroy_response (response);
}
Modified: libmicrohttpd/src/examples/minimal_example.c
===================================================================
--- libmicrohttpd/src/examples/minimal_example.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/examples/minimal_example.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -49,8 +49,9 @@
return MHD_YES;
}
*ptr = NULL; /* reset when done */
- response = MHD_create_response_from_data (strlen (me),
- (void *) me, MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (me),
+ (void *) me,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
Modified: libmicrohttpd/src/examples/querystring_example.c
===================================================================
--- libmicrohttpd/src/examples/querystring_example.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/examples/querystring_example.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -57,7 +57,8 @@
if (me == NULL)
return MHD_NO;
sprintf (me, fmt, "q", val);
- response = MHD_create_response_from_data (strlen (me), me, MHD_YES, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (me), me,
+ MHD_RESPMEM_MUST_FREE);
if (response == NULL)
{
free (me);
Modified: libmicrohttpd/src/examples/refuse_post_example.c
===================================================================
--- libmicrohttpd/src/examples/refuse_post_example.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/examples/refuse_post_example.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -56,9 +56,9 @@
/* always to busy for POST requests */
if (0 == strcmp (method, "POST"))
{
- response = MHD_create_response_from_data (strlen (BUSYPAGE),
- (void *) BUSYPAGE, MHD_NO,
- MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (BUSYPAGE),
+ (void *) BUSYPAGE,
+ MHD_RESPMEM_PERSISTENT);
ret =
MHD_queue_response (connection, MHD_HTTP_SERVICE_UNAVAILABLE,
response);
@@ -68,8 +68,9 @@
}
*ptr = NULL; /* reset when done */
- response = MHD_create_response_from_data (strlen (me),
- (void *) me, MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (me),
+ (void *) me,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h 2011-01-03 16:00:02 UTC (rev
14106)
+++ libmicrohttpd/src/include/microhttpd.h 2011-01-04 12:40:03 UTC (rev
14107)
@@ -1199,6 +1199,8 @@
MHD_ContentReaderFreeCallback
crfc);
+
+
/**
* Create a response object. The response object can be extended with
* header information and then be used any number of times.
@@ -1210,6 +1212,7 @@
* right away, the data maybe released anytime after
* this call returns
* @return NULL on error (i.e. invalid arguments, out of memory)
+ * @deprecated use MHD_create_response_from_buffer instead
*/
struct MHD_Response *MHD_create_response_from_data (size_t size,
void *data,
@@ -1218,12 +1221,59 @@
/**
+ * Specification for how MHD should treat the memory buffer
+ * given for the response.
+ */
+enum MHD_ResponseMemoryMode {
+
+ /**
+ * Buffer is a persistent (static/global) buffer that won't change
+ * for at least the lifetime of the response, MHD should just use
+ * it, not free it, not copy it, just keep an alias to it.
+ */
+ MHD_RESPMEM_PERSISTENT,
+
+ /**
+ * Buffer is heap-allocated with 'malloc' (or equivalent) and
+ * should be freed by MHD after processing the response has
+ * concluded (response reference counter reaches zero).
+ */
+ MHD_RESPMEM_MUST_FREE,
+
+ /**
+ * Buffer is in transient memory, but not on the heap (for example,
+ * on the stack or non-malloc allocated) and only valid during the
+ * call to 'MHD_create_response_from_buffer'. MHD must make its
+ * own private copy of the data for processing.
+ */
+ MHD_RESPMEM_MUST_COPY
+
+};
+
+
+/**
* Create a response object. The response object can be extended with
* header information and then be used any number of times.
*
* @param size size of the data portion of the response
+ * @param buffer size bytes containing the response's data portion
+ * @param mode flags for buffer management
+ * @return NULL on error (i.e. invalid arguments, out of memory)
+ */
+struct MHD_Response *
+MHD_create_response_from_buffer (size_t size,
+ void *buffer,
+ enum MHD_ResponseMemoryMode mode);
+
+
+/**
+ * Create a response object. The response object can be extended with
+ * header information and then be used any number of times.
+ *
+ * @param size size of the data portion of the response
* @param fd file descriptor referring to a file on disk with the data; will
be closed when response is destroyed
* @return NULL on error (i.e. invalid arguments, out of memory)
+ * @deprecated use MHD_create_response_from_fd_at_offset instead
*/
struct MHD_Response *MHD_create_response_from_fd (size_t size,
int fd);
Modified: libmicrohttpd/src/testcurl/daemontest_digestauth.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_digestauth.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_digestauth.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -81,9 +81,9 @@
if ( (username == NULL) ||
(0 != strcmp (username, "testuser")) )
{
- response = MHD_create_response_from_data(strlen (DENIED),
- DENIED,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer(strlen (DENIED),
+ DENIED,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_auth_fail_response(connection, realm,
OPAQUE,
response,
@@ -99,9 +99,9 @@
if ( (ret == MHD_INVALID_NONCE) ||
(ret == MHD_NO) )
{
- response = MHD_create_response_from_data(strlen (DENIED),
- DENIED,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer(strlen (DENIED),
+ DENIED,
+ MHD_RESPMEM_PERSISTENT);
if (NULL == response)
return MHD_NO;
ret = MHD_queue_auth_fail_response(connection, realm,
@@ -111,8 +111,8 @@
MHD_destroy_response(response);
return ret;
}
- response = MHD_create_response_from_data(strlen(PAGE), PAGE,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer(strlen(PAGE), PAGE,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
MHD_destroy_response(response);
return ret;
Modified: libmicrohttpd/src/testcurl/daemontest_get.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_get.c 2011-01-03 16:00:02 UTC (rev
14106)
+++ libmicrohttpd/src/testcurl/daemontest_get.c 2011-01-04 12:40:03 UTC (rev
14107)
@@ -85,8 +85,9 @@
return MHD_YES;
}
*unused = NULL;
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
Modified: libmicrohttpd/src/testcurl/daemontest_iplimit.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_iplimit.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_iplimit.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -80,8 +80,9 @@
return MHD_YES;
}
*unused = NULL;
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
Modified: libmicrohttpd/src/testcurl/daemontest_large_put.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_large_put.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_large_put.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -122,8 +122,9 @@
*done = 1;
return MHD_YES;
}
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
Modified: libmicrohttpd/src/testcurl/daemontest_long_header.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_long_header.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_long_header.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -79,8 +79,9 @@
if (0 != strcmp (me, method))
return MHD_NO; /* unexpected method */
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
Modified: libmicrohttpd/src/testcurl/daemontest_parse_cookies.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_parse_cookies.c 2011-01-03
16:00:02 UTC (rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_parse_cookies.c 2011-01-04
12:40:03 UTC (rev 14107)
@@ -95,8 +95,9 @@
hdr = MHD_lookup_connection_value (connection, MHD_COOKIE_KIND, "name4");
if ((hdr == NULL) || (0 != strcmp (hdr, "var4 with spaces")))
abort ();
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
Modified: libmicrohttpd/src/testcurl/daemontest_post.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_post.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_post.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -113,9 +113,9 @@
MHD_post_process (pp, upload_data, *upload_data_size);
if ((eok == 3) && (0 == *upload_data_size))
{
- response = MHD_create_response_from_data (strlen (url),
- (void *) url,
- MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
MHD_destroy_post_processor (pp);
@@ -432,7 +432,8 @@
{
*unused = "wibble";
/* We don't want the body. Send a 500. */
- response = MHD_create_response_from_data(0, NULL, 0, 0);
+ response = MHD_create_response_from_buffer (0, NULL,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response(connection, 500, response);
if (ret != MHD_YES)
fprintf(stderr, "Failed to queue response\n");
Modified: libmicrohttpd/src/testcurl/daemontest_post_loop.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_post_loop.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_post_loop.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -83,7 +83,8 @@
{
if (*mptr != &marker)
abort ();
- response = MHD_create_response_from_data (2, "OK", MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (2, "OK",
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
*mptr = NULL;
Modified: libmicrohttpd/src/testcurl/daemontest_postform.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_postform.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_postform.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -116,9 +116,9 @@
MHD_post_process (pp, upload_data, *upload_data_size);
if ((eok == 3) && (0 == *upload_data_size))
{
- response = MHD_create_response_from_data (strlen (url),
- (void *) url,
- MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
MHD_destroy_post_processor (pp);
Modified: libmicrohttpd/src/testcurl/daemontest_process_arguments.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_process_arguments.c 2011-01-03
16:00:02 UTC (rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_process_arguments.c 2011-01-04
12:40:03 UTC (rev 14107)
@@ -88,8 +88,9 @@
MHD_GET_ARGUMENT_KIND, "hash");
if ((hdr == NULL) || (0 != strcmp (hdr, "#")))
abort ();
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
Modified: libmicrohttpd/src/testcurl/daemontest_process_headers.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_process_headers.c 2011-01-03
16:00:02 UTC (rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_process_headers.c 2011-01-04
12:40:03 UTC (rev 14107)
@@ -115,8 +115,9 @@
if ((hdr == NULL) || (0 != strcmp (hdr, "NowPresent")))
abort ();
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
MHD_add_response_header (response, "MyHeader", "MyValue");
hdr = MHD_get_response_header (response, "MyHeader");
if (0 != strcmp ("MyValue", hdr))
Modified: libmicrohttpd/src/testcurl/daemontest_put.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_put.c 2011-01-03 16:00:02 UTC (rev
14106)
+++ libmicrohttpd/src/testcurl/daemontest_put.c 2011-01-04 12:40:03 UTC (rev
14107)
@@ -102,8 +102,8 @@
*done = 1;
return MHD_YES;
}
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url), (void*) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
Modified: libmicrohttpd/src/testcurl/daemontest_put_chunked.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_put_chunked.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_put_chunked.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -111,8 +111,9 @@
#endif
return MHD_YES;
}
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
Modified: libmicrohttpd/src/testcurl/daemontest_termination.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_termination.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_termination.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -65,7 +65,8 @@
}
struct MHD_Response *response =
- MHD_create_response_from_data (strlen ("Response"), "Response", 0, 0);
+ MHD_create_response_from_buffer (strlen ("Response"), "Response",
+ MHD_RESPMEM_PERSISTENT);
int ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
Modified: libmicrohttpd/src/testcurl/daemontest_timeout.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_timeout.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testcurl/daemontest_timeout.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -113,8 +113,9 @@
*done = 1;
return MHD_YES;
}
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
Modified: libmicrohttpd/src/testcurl/https/mhds_get_test_select.c
===================================================================
--- libmicrohttpd/src/testcurl/https/mhds_get_test_select.c 2011-01-03
16:00:02 UTC (rev 14106)
+++ libmicrohttpd/src/testcurl/https/mhds_get_test_select.c 2011-01-04
12:40:03 UTC (rev 14107)
@@ -61,8 +61,9 @@
return MHD_YES;
}
*unused = NULL;
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
Modified: libmicrohttpd/src/testcurl/https/mhds_session_info_test.c
===================================================================
--- libmicrohttpd/src/testcurl/https/mhds_session_info_test.c 2011-01-03
16:00:02 UTC (rev 14106)
+++ libmicrohttpd/src/testcurl/https/mhds_session_info_test.c 2011-01-04
12:40:03 UTC (rev 14107)
@@ -78,9 +78,9 @@
return -1;
}
- response = MHD_create_response_from_data (strlen (EMPTY_PAGE),
- (void *) EMPTY_PAGE,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (EMPTY_PAGE),
+ (void *) EMPTY_PAGE,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
Modified: libmicrohttpd/src/testcurl/https/tls_test_common.c
===================================================================
--- libmicrohttpd/src/testcurl/https/tls_test_common.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testcurl/https/tls_test_common.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -178,9 +178,9 @@
return MHD_YES;
}
*ptr = NULL; /* reset when done */
- response = MHD_create_response_from_data (strlen (test_data),
- (void *) test_data,
- MHD_NO, MHD_NO);
+ response = MHD_create_response_from_buffer (strlen (test_data),
+ (void *) test_data,
+ MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
Modified: libmicrohttpd/src/testzzuf/daemontest_get.c
===================================================================
--- libmicrohttpd/src/testzzuf/daemontest_get.c 2011-01-03 16:00:02 UTC (rev
14106)
+++ libmicrohttpd/src/testzzuf/daemontest_get.c 2011-01-04 12:40:03 UTC (rev
14107)
@@ -81,8 +81,9 @@
return MHD_YES;
}
*unused = NULL;
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
if (ret == MHD_NO)
Modified: libmicrohttpd/src/testzzuf/daemontest_large_put.c
===================================================================
--- libmicrohttpd/src/testzzuf/daemontest_large_put.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testzzuf/daemontest_large_put.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -119,8 +119,9 @@
*done = 1;
return MHD_YES;
}
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
Modified: libmicrohttpd/src/testzzuf/daemontest_long_header.c
===================================================================
--- libmicrohttpd/src/testzzuf/daemontest_long_header.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testzzuf/daemontest_long_header.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -81,8 +81,9 @@
if (0 != strcmp (me, method))
return MHD_NO; /* unexpected method */
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
Modified: libmicrohttpd/src/testzzuf/daemontest_post.c
===================================================================
--- libmicrohttpd/src/testzzuf/daemontest_post.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testzzuf/daemontest_post.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -115,9 +115,9 @@
MHD_post_process (pp, upload_data, *upload_data_size);
if ((eok == 3) && (0 == *upload_data_size))
{
- response = MHD_create_response_from_data (strlen (url),
- (void *) url,
- MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
MHD_destroy_post_processor (pp);
Modified: libmicrohttpd/src/testzzuf/daemontest_postform.c
===================================================================
--- libmicrohttpd/src/testzzuf/daemontest_postform.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testzzuf/daemontest_postform.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -120,9 +120,9 @@
MHD_post_process (pp, upload_data, *upload_data_size);
if ((eok == 3) && (0 == *upload_data_size))
{
- response = MHD_create_response_from_data (strlen (url),
- (void *) url,
- MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
MHD_destroy_post_processor (pp);
Modified: libmicrohttpd/src/testzzuf/daemontest_put.c
===================================================================
--- libmicrohttpd/src/testzzuf/daemontest_put.c 2011-01-03 16:00:02 UTC (rev
14106)
+++ libmicrohttpd/src/testzzuf/daemontest_put.c 2011-01-04 12:40:03 UTC (rev
14107)
@@ -105,8 +105,9 @@
*done = 1;
return MHD_YES;
}
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
Modified: libmicrohttpd/src/testzzuf/daemontest_put_chunked.c
===================================================================
--- libmicrohttpd/src/testzzuf/daemontest_put_chunked.c 2011-01-03 16:00:02 UTC
(rev 14106)
+++ libmicrohttpd/src/testzzuf/daemontest_put_chunked.c 2011-01-04 12:40:03 UTC
(rev 14107)
@@ -111,8 +111,9 @@
#endif
return MHD_YES;
}
- response = MHD_create_response_from_data (strlen (url),
- (void *) url, MHD_NO, MHD_YES);
+ response = MHD_create_response_from_buffer (strlen (url),
+ (void *) url,
+ MHD_RESPMEM_MUST_COPY);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
return ret;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14107 - in libmicrohttpd: . doc doc/chapters doc/examples src/daemon src/examples src/include src/testcurl src/testcurl/https src/testzzuf,
gnunet <=