gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 06/14: Added new API function MHD_create_response_from_b


From: gnunet
Subject: [libmicrohttpd] 06/14: Added new API function MHD_create_response_from_buffer_static()
Date: Tue, 19 Apr 2022 19:31:13 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit d3ae3c432d1d83bf5d300ca4670aa2626c574496
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Apr 18 11:17:45 2022 +0300

    Added new API function MHD_create_response_from_buffer_static()
---
 src/include/microhttpd.h  | 28 +++++++++++++++++++++++++++-
 src/microhttpd/response.c | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 6d0eb4c8..8178584c 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -96,7 +96,7 @@ extern "C"
  * they are parsed as decimal numbers.
  * Example: 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00097505
+#define MHD_VERSION 0x00097506
 
 /* If generic headers don't work on your platform, include headers
    which define 'va_list', 'size_t', 'ssize_t', 'intptr_t',
@@ -3538,6 +3538,32 @@ MHD_create_response_from_buffer (size_t size,
                                  enum MHD_ResponseMemoryMode mode);
 
 
+/**
+ * Create a response object with the content of provided statically allocated
+ * buffer used as the response body.
+ *
+ * The buffer must be valid for the lifetime of the response. The easiest way
+ * to achieve this is to use a statically allocated buffer.
+ *
+ * The response object can be extended with header information and then
+ * be used any number of times.
+ *
+ * If response object is used to answer HEAD request then the body
+ * of the response is not used, while all headers (including automatic
+ * headers) are used.
+ *
+ * @param size the size of the data in @a buffer, can be zero
+ * @param buffer the buffer with the data for the response body, can be NULL
+ *               if @a size is zero
+ * @return NULL on error (i.e. invalid arguments, out of memory)
+ * @note Available since #MHD_VERSION 0x00097506
+ * @ingroup response
+ */
+_MHD_EXTERN struct MHD_Response *
+MHD_create_response_from_buffer_static (size_t size,
+                                        const void *buffer);
+
+
 /**
  * Create a response object with the content of provided buffer used as
  * the response body.
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index b63db1e5..ef04f584 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -1378,6 +1378,38 @@ MHD_create_response_from_buffer (size_t size,
 }
 
 
+/**
+ * Create a response object with the content of provided statically allocated
+ * buffer used as the response body.
+ *
+ * The buffer must be valid for the lifetime of the response. The easiest way
+ * to achieve this is to use a statically allocated buffer.
+ *
+ * The response object can be extended with header information and then
+ * be used any number of times.
+ *
+ * If response object is used to answer HEAD request then the body
+ * of the response is not used, while all headers (including automatic
+ * headers) are used.
+ *
+ * @param size the size of the data in @a buffer, can be zero
+ * @param buffer the buffer with the data for the response body, can be NULL
+ *               if @a size is zero
+ * @return NULL on error (i.e. invalid arguments, out of memory)
+ * @note Available since #MHD_VERSION 0x00097506
+ * @ingroup response
+ */
+_MHD_EXTERN struct MHD_Response *
+MHD_create_response_from_buffer_static (size_t size,
+                                        const void *buffer)
+{
+  return MHD_create_response_from_buffer_with_free_callback_cls (size,
+                                                                 buffer,
+                                                                 NULL,
+                                                                 NULL);
+}
+
+
 /**
  * Create a response object with the content of provided buffer used as
  * the response body.

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]