gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (0b07383f -> 1ffe7932)


From: gnunet
Subject: [libmicrohttpd] branch master updated (0b07383f -> 1ffe7932)
Date: Sun, 06 Nov 2022 13:10:08 +0100

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 0b07383f configure: sorted summary messages
     new b040c278 configure: improved check for asserts
     new 8d6d9be0 Fixed macro name spelling
     new 377e2cbd connection: refuse requests with unsupported Transfer-Encoding
     new 099b50e4 connection: reject or log requests with both chunked encoding 
and Content-Length
     new 1ffe7932 Tests and examples: added rule to (re-)build libmicrohttpd.la

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 configure.ac                   | 207 +++++++++++++++++++++++++++++++++++------
 doc/examples/Makefile.am       |   4 +
 src/examples/Makefile.am       |   4 +
 src/include/mhd_options.h      |   6 +-
 src/microhttpd/connection.c    |  67 ++++++++++++-
 src/microhttpd/memorypool.c    |   2 +-
 src/microhttpd_ws/Makefile.am  |   4 +
 src/testcurl/Makefile.am       |   4 +
 src/testcurl/https/Makefile.am |   4 +
 src/testzzuf/Makefile.am       |   4 +
 10 files changed, 269 insertions(+), 37 deletions(-)

diff --git a/configure.ac b/configure.ac
index 536a4d66..39548981 100644
--- a/configure.ac
+++ b/configure.ac
@@ -226,7 +226,7 @@ choke me now
         AS_CASE([${enable_build_type}],[*-compact],
           [
             enable_compact_code="yes"
-            compact_code_MSG="enabled by build type ${enable_build_type}"
+            compact_code_MSG="enabled by 
--enable-build-type=${enable_build_type}"
             AC_DEFINE([MHD_FAVOR_SMALL_CODE],[1])
           ]
         )
@@ -3640,44 +3640,191 @@ AS_VAR_IF([use_heavy_tests], ["yes"],
 AC_MSG_RESULT([$CPU_COUNT])
 
 
-AC_MSG_CHECKING([[whether to enable debug asserts]])
 AC_ARG_ENABLE([[asserts]],
   [AS_HELP_STRING([[--enable-asserts]],
     [enable test build with debug asserts])],
   [],
-  [AS_CASE([${enable_build_type}],[debug|debugger],
-    [enable_asserts='yes'],[enable_asserts='no'])]
+  [enable_asserts='auto']
+)
+AS_UNSET([use_asserts_MSG])
+AC_CACHE_CHECK([[whether NDEBUG macro is defined]], [mhd_cv_macro_ndebug_def],
+  [
+    AC_LINK_IFELSE(
+      [
+        AC_LANG_SOURCE([[
+#ifndef NDEBUG
+#error NDEBUG is NOT defined
+chome me now
+#endif
+
+int main(void)
+{
+  return 0;
+}
+          ]]
+        )
+      ],
+      [[mhd_cv_macro_ndebug_def='yes']],
+      [[mhd_cv_macro_ndebug_def='no']]
+    )
+  ]
+)
+AS_VAR_IF([enable_asserts],["yes"],
+  [
+    AS_VAR_IF([mhd_cv_macro_ndebug_def],["yes"],
+      [
+        AC_MSG_FAILURE([Parameter --enable-asserts is specified, but NDEBUG 
macro is defined as well])
+      ]
+    )
+    use_asserts_MSG="yes, enabled by configure parameter"
+  ]
+)
+AC_CACHE_CHECK([[whether _DEBUG macro is defined]], [mhd_cv_macro__debug_def],
+  [
+    AC_LINK_IFELSE(
+      [
+        AC_LANG_SOURCE([[
+#ifndef _DEBUG
+#error _DEBUG is NOT defined
+chome me now
+#endif
+
+int main(void)
+{
+  return 0;
+}
+          ]]
+        )
+      ],
+      [[mhd_cv_macro__debug_def='yes']],
+      [[mhd_cv_macro__debug_def='no']]
+    )
+  ]
+)
+AS_VAR_IF([enable_asserts],["no"],
+  [
+    AS_VAR_IF([mhd_cv_macro__debug_def],["yes"],
+      [
+        AC_MSG_FAILURE([Parameter --disable-asserts is specified, but _DEBUG 
macro is defined as well])
+      ]
+    )
+    use_asserts_MSG="no, set by configure parameter"
+  ]
+)
+AS_IF([test "x${mhd_cv_macro_ndebug_def}" = "xyes" && test 
"x${mhd_cv_macro__debug_def}" = "xyes"],
+  [AC_MSG_FAILURE([Both NDEBUG and _DEBUG macros are defined])]
+)
+AS_VAR_IF([enable_asserts],["auto"],
+  [
+    AS_VAR_IF([mhd_cv_macro_ndebug_def],["yes"],
+      [
+        enable_asserts="no"
+        use_asserts_MSG="no, set by NDEBUG preprocessor macro"
+      ]
+    )
+  ]
+)
+AS_VAR_IF([enable_asserts],["auto"],
+  [
+    AS_VAR_IF([mhd_cv_macro__debug_def],["yes"],
+      [
+        enable_asserts="yes"
+        use_asserts_MSG="yes, enabled by _DEBUG preprocessor macro"
+      ]
+    )
+  ]
+)
+AS_VAR_IF([enable_asserts],["auto"],
+  [
+    AC_CACHE_CHECK([[whether DEBUG macro is defined]], 
[mhd_cv_macro_debug_def],
+      [
+        AC_LINK_IFELSE(
+          [
+            AC_LANG_SOURCE([[
+#ifndef DEBUG
+#error DEBUG is NOT defined
+chome me now
+#endif
+
+int main(void)
+{
+  return 0;
+}
+              ]]
+            )
+          ],
+          [[mhd_cv_macro_debug_def='yes']],
+          [[mhd_cv_macro_debug_def='no']]
+        )
+      ]
+    )
+    AS_VAR_IF([mhd_cv_macro_debug_def],["yes"],
+      [
+        enable_asserts="yes"
+        use_asserts_MSG="yes, enabled by DEBUG preprocessor macro"
+      ]
+    )
+  ]
+)
+AC_MSG_CHECKING([[whether to enable debug asserts]])
+AS_VAR_IF([enable_asserts],["auto"],
+  [
+    AS_CASE([${enable_build_type}],
+      [debug|debugger],
+      [
+        enable_asserts="yes"
+        use_asserts_MSG="yes, enabled by 
--enable-bulid-type=${enable_build_type}"
+      ],
+      [
+        enable_asserts="no"
+        use_asserts_MSG="no"
+      ]
+    )
+  ]
 )
 AS_CASE([[$enable_asserts]], [[yes]], [[:]], [[no]], [[:]], 
[[enable_asserts='no']])
-AC_MSG_RESULT([[$enable_asserts]])
+AC_MSG_RESULT([[${use_asserts_MSG=no}]])
 
 AS_VAR_IF([[enable_asserts]], [["yes"]],
   [
-   MHD_PREPEND_FLAG_TO_VAR([CPPFLAGS_ac],[-D_DEBUG=1])
-   CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
-   [mhd_assert_test_prg="#include <assert.h>
-   int pos_val(void) {return 5;}
-   int neg_val(void) {return -5;}
-   int main(void)
-   { int pos_var = pos_val(), neg_var = neg_val();
-     assert(neg_var > pos_var); /* Must trigger assert. */
-     (void)pos_var; (void)neg_var;
-     return 0; }
-   "]
-   AC_CACHE_CHECK([[whether system assert() is available]], 
[mhd_cv_sys_assert_avail],
-     [
-      AC_LINK_IFELSE([AC_LANG_SOURCE([[$mhd_assert_test_prg]])],
-                     [[mhd_cv_sys_assert_avail='yes']],
-                     [[mhd_cv_sys_assert_avail='no']])
-     ]
-   )
-   AS_VAR_IF([[mhd_cv_sys_assert_avail]], [["no"]], [],
-     [AC_DEFINE([[HAVE_ASSERT]], [[1]], [Define if you have usable assert() 
and assert.h])])
-   AS_UNSET([mhd_assert_test_prg])
+    AS_VAR_IF([[mhd_cv_macro__debug_def]], [["yes"]], [:],
+      [
+        MHD_PREPEND_FLAG_TO_VAR([CPPFLAGS_ac],[-D_DEBUG=1])
+        CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
+      ]
+    )
+    AC_CACHE_CHECK([[whether system assert() is available]], 
[mhd_cv_sys_assert_avail],
+      [
+        AC_LINK_IFELSE(
+          [
+            AC_LANG_SOURCE([[
+#include <assert.h>
+
+static int pos_val(void) {return 5;}
+static int neg_val(void) {return -5;}
+int main(void)
+{
+  int pos_var = pos_val(), neg_var = neg_val();
+  assert(neg_var > pos_var); /* Must trigger assert. */
+  return pos_var + neg_var;
+}
+            ]])
+          ],
+          [[mhd_cv_sys_assert_avail='yes']],
+          [[mhd_cv_sys_assert_avail='no']]
+        )
+      ]
+    )
+    AS_VAR_IF([[mhd_cv_sys_assert_avail]], [["no"]], [],
+      [AC_DEFINE([[HAVE_ASSERT]], [[1]], [Define if you have usable assert() 
and assert.h])])
   ],
   [
-    MHD_PREPEND_FLAG_TO_VAR([CPPFLAGS_ac],[-DNDEBUG=1])
-    CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
+    AS_VAR_IF([[mhd_cv_macro_ndebug_def]], [["yes"]], [:],
+      [
+        MHD_PREPEND_FLAG_TO_VAR([CPPFLAGS_ac],[-DNDEBUG=1])
+        CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
+      ]
+    )
   ]
 )
 
@@ -3893,7 +4040,7 @@ int ptr_process(void *ptr1, void *ptr2)
                          ]
                        )
                        AS_VAR_IF([mhd_cv_func_attribute_nosanitize_ptr], 
["yes"],
-                         [AC_DEFINE([FUNC_ATTR_PTRCOMPARE_WOKRS],[1],[Define 
to '1' if '__attribute__((no_sanitize("pointer-compare","pointer-subtract")))' 
works])],
+                         [AC_DEFINE([FUNC_ATTR_PTRCOMPARE_WORKS],[1],[Define 
to '1' if '__attribute__((no_sanitize("pointer-compare","pointer-subtract")))' 
works])],
                          [
                            AC_CACHE_CHECK([whether 
'__attribute__((no_sanitize("address")))' works for pointers compare], 
[mhd_cv_func_attribute_nosanitize_addr],
                              [
@@ -4340,7 +4487,7 @@ AC_MSG_NOTICE([GNU libmicrohttpd ${PACKAGE_VERSION} 
Configuration Summary:
   HTTPS support:     ${MSG_HTTPS}
   Compact code:      ${enable_compact_code} (${compact_code_MSG})
   Use thread names:  ${enable_thread_names}
-  Use debug asserts: ${enable_asserts}
+  Use debug asserts: ${use_asserts_MSG=no}
   Use sanitizers:    ${enabled_sanitizers:=no}
   Build docs:        ${enable_doc}
   Build examples:    ${enable_examples}
diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
index c7a24354..67302b2f 100644
--- a/doc/examples/Makefile.am
+++ b/doc/examples/Makefile.am
@@ -15,6 +15,10 @@ if USE_COVERAGE
   AM_CFLAGS += --coverage
 endif
 
+$(top_builddir)/src/microhttpd/libmicrohttpd.la: 
$(top_builddir)/src/microhttpd/Makefile
+       @echo ' cd $(top_builddir)/src/microhttpd && $(MAKE) $(AM_MAKEFLAGS) 
libmicrohttpd.la'; \
+       $(am__cd) $(top_builddir)/src/microhttpd && $(MAKE) $(AM_MAKEFLAGS) 
libmicrohttpd.la
+
 # example programs
 noinst_PROGRAMS = \
   hellobrowser \
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index 7946745a..e22fe7ed 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -18,6 +18,10 @@ if USE_COVERAGE
   AM_CFLAGS += --coverage
 endif
 
+$(top_builddir)/src/microhttpd/libmicrohttpd.la: 
$(top_builddir)/src/microhttpd/Makefile
+       @echo ' cd $(top_builddir)/src/microhttpd && $(MAKE) $(AM_MAKEFLAGS) 
libmicrohttpd.la'; \
+       $(am__cd) $(top_builddir)/src/microhttpd && $(MAKE) $(AM_MAKEFLAGS) 
libmicrohttpd.la
+
 
 # example programs
 noinst_PROGRAMS = \
diff --git a/src/include/mhd_options.h b/src/include/mhd_options.h
index dbfc2409..85ad6555 100644
--- a/src/include/mhd_options.h
+++ b/src/include/mhd_options.h
@@ -156,17 +156,17 @@
 #endif /* MHD_ASAN_ACTIVE */
 
 #if defined(MHD_ASAN_ACTIVE) && defined(HAVE_SANITIZER_ASAN_INTERFACE_H) && \
-  (defined(FUNC_ATTR_PTRCOMPARE_WOKRS) || defined(FUNC_ATTR_NOSANITIZE_WORKS))
+  (defined(FUNC_ATTR_PTRCOMPARE_WORKS) || defined(FUNC_ATTR_NOSANITIZE_WORKS))
 #ifndef MHD_ASAN_POISON_ACTIVE
 /* Manual ASAN poisoning could be used */
 #warning User memory poisoning is not active
 #endif /* ! MHD_ASAN_POISON_ACTIVE */
 #else  /* ! (MHD_ASAN_ACTIVE && HAVE_SANITIZER_ASAN_INTERFACE_H &&
-           (FUNC_ATTR_PTRCOMPARE_WOKRS || FUNC_ATTR_NOSANITIZE_WORKS))   */
+           (FUNC_ATTR_PTRCOMPARE_WORKS || FUNC_ATTR_NOSANITIZE_WORKS))   */
 #ifdef MHD_ASAN_POISON_ACTIVE
 #error User memory poisoning is active, but conditions are not suitable
 #endif /* MHD_ASAN_POISON_ACTIVE */
 #endif /* ! (MHD_ASAN_ACTIVE && HAVE_SANITIZER_ASAN_INTERFACE_H &&
-           (FUNC_ATTR_PTRCOMPARE_WOKRS || FUNC_ATTR_NOSANITIZE_WORKS))   */
+           (FUNC_ATTR_PTRCOMPARE_WORKS || FUNC_ATTR_NOSANITIZE_WORKS))   */
 
 #endif /* MHD_OPTIONS_H */
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 89955e84..19d1c699 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -89,6 +89,34 @@
 #define REQUEST_LACKS_HOST ""
 #endif
 
+/**
+ * Response text used when the request has unsupported "Transfer-Enconding:".
+ */
+#ifdef HAVE_MESSAGES
+#define REQUEST_UNSUPPORTED_TR_ENCODING \
+  "<html>" \
+  "<head><title>Unsupported Transfer-Encoding</title></head>" \
+  "<body>The Transfer-Encoding used in request is not supported.</body>" \
+  "</html>"
+#else
+#define REQUEST_UNSUPPORTED_TR_ENCODING ""
+#endif
+
+/**
+ * Response text used when the request has unsupported both headers:
+ * "Transfer-Enconding:" and "Content-Length:"
+ */
+#ifdef HAVE_MESSAGES
+#define REQUEST_LENGTH_WITH_TR_ENCODING \
+  "<html>" \
+  "<head><title>Malformed request</title></head>" \
+  "<body>Wrong combination of the request headers: both Transfer-Encoding " \
+  "and Content-Length headers are used at the same time.</body>" \
+  "</html>"
+#else
+#define REQUEST_LENGTH_WITH_TR_ENCODING ""
+#endif
+
 /**
  * Response text used when the request (http header) is
  * malformed.
@@ -3975,10 +4003,43 @@ parse_connection_headers (struct MHD_Connection 
*connection)
                                      &enc,
                                      NULL))
   {
+    if (! MHD_str_equal_caseless_ (enc,
+                                   "chunked"))
+    {
+      transmit_error_response_static (connection,
+                                      MHD_HTTP_BAD_REQUEST,
+                                      REQUEST_UNSUPPORTED_TR_ENCODING);
+      return;
+    }
+    else if (MHD_NO !=
+             MHD_lookup_connection_value_n (connection,
+                                            MHD_HEADER_KIND,
+                                            MHD_HTTP_HEADER_CONTENT_LENGTH,
+                                            MHD_STATICSTR_LEN_ ( \
+                                              MHD_HTTP_HEADER_CONTENT_LENGTH),
+                                            NULL,
+                                            NULL))
+    {
+      /* TODO: add individual settings */
+      if (1 <= connection->daemon->strict_for_client)
+      {
+        transmit_error_response_static (connection,
+                                        MHD_HTTP_BAD_REQUEST,
+                                        REQUEST_LENGTH_WITH_TR_ENCODING);
+        return;
+      }
+#ifdef HAVE_MESSAGES
+      else
+      {
+        MHD_DLOG (connection->daemon,
+                  _ ("The 'Content-Length' request header is ignored "
+                     "as chunked Transfer-Encoding is used "
+                     "for this request.\n"));
+      }
+#endif /* HAVE_MESSAGES */
+    }
+    connection->rq.have_chunked_upload = true;
     connection->rq.remaining_upload_size = MHD_SIZE_UNKNOWN;
-    if (MHD_str_equal_caseless_ (enc,
-                                 "chunked"))
-      connection->rq.have_chunked_upload = true;
   }
   else
   {
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index c239a2df..5d656b47 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -103,7 +103,7 @@
 #define _MHD_POISON_MEMORY(pointer, size) (void)0
 #define _MHD_UNPOISON_MEMORY(pointer, size) (void)0
 #else  /* MHD_ASAN_POISON_ACTIVE */
-#if defined(FUNC_ATTR_PTRCOMPARE_WOKRS)
+#if defined(FUNC_ATTR_PTRCOMPARE_WORKS)
 #define _MHD_NOSANITIZE_PTRS \
   __attribute__((no_sanitize("pointer-compare","pointer-subtract")))
 #elif defined(FUNC_ATTR_NOSANITIZE_WORKS)
diff --git a/src/microhttpd_ws/Makefile.am b/src/microhttpd_ws/Makefile.am
index 16612506..3ce8a9fe 100644
--- a/src/microhttpd_ws/Makefile.am
+++ b/src/microhttpd_ws/Makefile.am
@@ -5,6 +5,10 @@ AM_CPPFLAGS = \
 
 AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS)
 
+$(top_builddir)/src/microhttpd/libmicrohttpd.la: 
$(top_builddir)/src/microhttpd/Makefile
+       @echo ' cd $(top_builddir)/src/microhttpd && $(MAKE) $(AM_MAKEFLAGS) 
libmicrohttpd.la'; \
+       $(am__cd) $(top_builddir)/src/microhttpd && $(MAKE) $(AM_MAKEFLAGS) 
libmicrohttpd.la
+
 noinst_DATA =
 MOSTLYCLEANFILES =
 
diff --git a/src/testcurl/Makefile.am b/src/testcurl/Makefile.am
index e0f8d275..cc685d3b 100644
--- a/src/testcurl/Makefile.am
+++ b/src/testcurl/Makefile.am
@@ -29,6 +29,10 @@ LDADD = \
   $(top_builddir)/src/microhttpd/libmicrohttpd.la \
   @LIBCURL@
 
+$(top_builddir)/src/microhttpd/libmicrohttpd.la: 
$(top_builddir)/src/microhttpd/Makefile
+       @echo ' cd $(top_builddir)/src/microhttpd && $(MAKE) $(AM_MAKEFLAGS) 
libmicrohttpd.la'; \
+       $(am__cd) $(top_builddir)/src/microhttpd && $(MAKE) $(AM_MAKEFLAGS) 
libmicrohttpd.la
+
 THREAD_ONLY_TESTS = \
   test_urlparse \
   test_long_header \
diff --git a/src/testcurl/https/Makefile.am b/src/testcurl/https/Makefile.am
index 324a5314..f07ecebc 100644
--- a/src/testcurl/https/Makefile.am
+++ b/src/testcurl/https/Makefile.am
@@ -22,6 +22,10 @@ if USE_COVERAGE
   AM_CFLAGS += --coverage
 endif
 
+$(top_builddir)/src/microhttpd/libmicrohttpd.la: 
$(top_builddir)/src/microhttpd/Makefile
+       @echo ' cd $(top_builddir)/src/microhttpd && $(MAKE) $(AM_MAKEFLAGS) 
libmicrohttpd.la'; \
+       $(am__cd) $(top_builddir)/src/microhttpd && $(MAKE) $(AM_MAKEFLAGS) 
libmicrohttpd.la
+
 LDADD = \
   $(top_builddir)/src/microhttpd/libmicrohttpd.la \
   $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) @LIBGCRYPT_LIBS@ @LIBCURL@
diff --git a/src/testzzuf/Makefile.am b/src/testzzuf/Makefile.am
index d82d04e4..69c6df87 100644
--- a/src/testzzuf/Makefile.am
+++ b/src/testzzuf/Makefile.am
@@ -20,6 +20,10 @@ LDADD = \
   $(top_builddir)/src/microhttpd/libmicrohttpd.la \
   @LIBCURL@
 
+$(top_builddir)/src/microhttpd/libmicrohttpd.la: 
$(top_builddir)/src/microhttpd/Makefile
+       @echo ' cd $(top_builddir)/src/microhttpd && $(MAKE) $(AM_MAKEFLAGS) 
libmicrohttpd.la'; \
+       $(am__cd) $(top_builddir)/src/microhttpd && $(MAKE) $(AM_MAKEFLAGS) 
libmicrohttpd.la
+
 EXTRA_DIST = README socat.c
 
 THREAD_ONLY_TESTS = \

-- 
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]