gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated: introducte MHD_RO_FR


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated: introducte MHD_RO_FREE_FUNCTION as proposed by Nicolas Mora on the list
Date: Mon, 22 Jul 2019 11:50:56 +0200

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

grothoff pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new 3d1b9411 introducte MHD_RO_FREE_FUNCTION as proposed by Nicolas Mora 
on the list
3d1b9411 is described below

commit 3d1b941137f9d8379e6e67d5abd57be5ae6ebe1a
Author: Christian Grothoff <address@hidden>
AuthorDate: Mon Jul 22 11:49:42 2019 +0200

    introducte MHD_RO_FREE_FUNCTION as proposed by Nicolas Mora on the list
---
 ChangeLog                 |  5 ++++-
 doc/libmicrohttpd.texi    |  8 ++++++++
 src/include/microhttpd.h  | 39 ++++++++++++++++++++++++++++-----------
 src/microhttpd/response.c | 10 +++++++++-
 4 files changed, 49 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6a057b73..e9e19071 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+Mon 22 Jul 2019 11:49:03 AM CEST
+    Introduce MHD_RO_FREE_FUNCTION. -NM/CG
+
 Tue Jul 16 19:56:14 CEST 2019
        Add MHD_OPTION_HTTPS_CERT_CALLBACK2 to allow OCSP stapling
    and MHD_FEATURE_HTTPS_CERT_CALLBACK2 to check for. -TR
@@ -102,7 +105,7 @@ Sun Apr 21 16:40:00 MSK 2019
 
 Fri Apr 19 23:00:00 MSK 2019
        Rewritten SHA-256 calculations from scratch to avoid changing LGPL 
version;
-       Added usage of GCC/Clang built-ins for bytes swap to significantly 
improve 
+       Added usage of GCC/Clang built-ins for bytes swap to significantly 
improve
        speed of MD5 and SHA-256 calculation on platforms with known endianness.
        Added test for SHA-256 calculations. -EG
 
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index 6f34d799..aa3f0242 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -1219,6 +1219,14 @@ Response-specific options.  Passed in the varargs 
portion of
 @item MHD_RO_END
 No more options / last option.  This is used to terminate the VARARGs
 list.
+
+@item MHD_RO_FREE_FUNCTION
+Use a custom function for freeing the memory passed when using
+@code{MHD_create_response_from_buffer} with
+@code{MHD_RESPMEM_MUST_FREE}. This replaces the use of libc's
+@code{free()} function to release the memory with an implementation
+provided by the application. The next argument must be of type
+@code{MHD_FreeFunction}.
 @end table
 @end deftp
 
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 9d28cdb1..34f82154 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -132,7 +132,7 @@ typedef intptr_t ssize_t;
  * Current version of the library.
  * 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00096502
+#define MHD_VERSION 0x00096503
 
 /**
  * MHD-internal return code for "YES".
@@ -2678,7 +2678,7 @@ _MHD_EXTERN int
 MHD_set_connection_value (struct MHD_Connection *connection,
                           enum MHD_ValueKind kind,
                           const char *key,
-                         const char *value);
+                          const char *value);
 
 
 /**
@@ -2708,11 +2708,11 @@ MHD_set_connection_value (struct MHD_Connection 
*connection,
  */
 int
 MHD_set_connection_value_n (struct MHD_Connection *connection,
-                           enum MHD_ValueKind kind,
-                           const char *key,
+                            enum MHD_ValueKind kind,
+                            const char *key,
                             size_t key_size,
-                           const char *value,
-                           size_t value_size);
+                            const char *value,
+                            size_t value_size);
 
 
 /**
@@ -2806,7 +2806,7 @@ MHD_lookup_connection_value_n (struct MHD_Connection 
*connection,
 _MHD_EXTERN int
 MHD_queue_response (struct MHD_Connection *connection,
                     unsigned int status_code,
-                   struct MHD_Response *response);
+                    struct MHD_Response *response);
 
 
 /**
@@ -2895,13 +2895,30 @@ enum MHD_ResponseFlags
  */
 enum MHD_ResponseOptions
 {
-  /**
-   * End of the list of options.
-   */
-  MHD_RO_END = 0
+
+ /**
+  * End of the list of options.
+  */
+ MHD_RO_END = 0,
+
+ /**
+  * Set a specific free() function
+  * to free response buffer instead of libc void free(void * ptr)
+  */
+ MHD_RO_FREE_FUNCTION = 1
+
 };
 
 
+/**
+ * This typedef is defined to be able to pass a function pointer
+ * as a va_arg in #MHD_set_response_options() in combination
+ * with #MHD_RO_FREE_FUNCTION.
+ */
+typedef void
+(*MHD_FreeFunction)(void *);
+
+
 /**
  * Set special flags and options for a response.
  *
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 035e3054..21be419b 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -400,7 +400,6 @@ MHD_create_response_from_callback (uint64_t size,
   return response;
 }
 
-
 /**
  * Set special flags and options for a response.
  *
@@ -425,6 +424,15 @@ MHD_set_response_options (struct MHD_Response *response,
   {
     switch (ro)
     {
+    case MHD_RO_FREE_FUNCTION:
+      va_start (ap, flags);
+      if (NULL != (response->crfc = va_arg (ap, MHD_free_ptr))) {
+        ret = MHD_YES;
+      } else {
+        ret = MHD_NO;
+      }
+      va_end (ap);
+      break;
     default:
       ret = MHD_NO;
       break;

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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