gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (9cb16af3 -> b6a6f46c)


From: gnunet
Subject: [libmicrohttpd] branch master updated (9cb16af3 -> b6a6f46c)
Date: Mon, 25 Oct 2021 15:58:50 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 9cb16af3 connection.c: fixed copy-paste error in comment
     new 4e745237 mhd_str: fixed typos in doxy comments
     new a2798b7c Chunked response: close connection if application returns 
more data than requested
     new 03a73cf1 Removed unneeded cast of MHD_CONTENT_READER_END_* values
     new bf024f23 connection.c: fixed compiler warning
     new f971d78f configure: removed unused HAVE_DECL_SOCK_NONBLOCK macro from 
MHD_config.h
     new 481c63ba mhd_mono_clock: do not use MinGW clock wrappers on W32
     new 75f339b0 tsearch.c: fixed missing include after 
f66a23d27116ade5876d7e23d8c077091cd572e9
     new b6a6f46c Fixed builds with MSVS

The 8 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                    |  7 ++++---
 src/microhttpd/connection.c     | 20 ++++++++++++++------
 src/microhttpd/mhd_align.h      |  2 +-
 src/microhttpd/mhd_mono_clock.c |  9 +++++++--
 src/microhttpd/mhd_str.c        |  2 +-
 src/microhttpd/mhd_str.h        | 10 +++++-----
 src/microhttpd/tsearch.c        |  7 ++++---
 w32/common/MHD_config.h         | 41 +++++++++++++++++++++++++++++++++++++----
 8 files changed, 73 insertions(+), 25 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7b363d6d..b922e2c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1609,8 +1609,8 @@ errno_t gmtime_s(struct tm* _tm, const time_t* time);
 #include <time.h>]])
 
 
-AC_CHECK_DECLS([SOCK_NONBLOCK], [AC_DEFINE([HAVE_SOCK_NONBLOCK], [1], 
[SOCK_NONBLOCK is defined in a socket header])], [],
-                   [
+AC_CHECK_DECL([SOCK_NONBLOCK], [AC_DEFINE([HAVE_SOCK_NONBLOCK], [1], 
[SOCK_NONBLOCK is defined in a socket header])], [],
+  [[
 #if defined(HAVE_SYS_TYPES_H)
 #  include <sys/types.h>
 #endif
@@ -1619,7 +1619,8 @@ AC_CHECK_DECLS([SOCK_NONBLOCK], 
[AC_DEFINE([HAVE_SOCK_NONBLOCK], [1], [SOCK_NONB
 #elif defined(HAVE_WINSOCK2_H)
 #  include <winsock2.h>
 #endif
-                   ])
+  ]]
+)
 
 
 AC_CHECK_DECL([[clock_gettime]],
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 9f550221..e5ca32d1 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1053,8 +1053,8 @@ try_ready_normal_body (struct MHD_Connection *connection)
                        (size_t) MHD_MIN ((uint64_t) response->data_buffer_size,
                                          response->total_size
                                          - 
connection->response_write_position));
-  if ( (((ssize_t) MHD_CONTENT_READER_END_OF_STREAM) == ret) ||
-       (((ssize_t) MHD_CONTENT_READER_END_WITH_ERROR) == ret) )
+  if ( (MHD_CONTENT_READER_END_OF_STREAM == ret) ||
+       (MHD_CONTENT_READER_END_WITH_ERROR == ret) )
   {
     /* either error or http 1.0 transfer, close socket! */
     /* TODO: do not update total size, check whether response
@@ -1063,7 +1063,7 @@ try_ready_normal_body (struct MHD_Connection *connection)
 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
     MHD_mutex_unlock_chk_ (&response->mutex);
 #endif
-    if ( ((ssize_t) MHD_CONTENT_READER_END_OF_STREAM) == ret)
+    if (MHD_CONTENT_READER_END_OF_STREAM == ret)
       MHD_connection_close_ (connection,
                              MHD_REQUEST_TERMINATED_COMPLETED_OK);
     else
@@ -1192,7 +1192,7 @@ try_ready_chunked_body (struct MHD_Connection *connection,
                          &connection->write_buffer[max_chunk_hdr_len],
                          size_to_fill);
   }
-  if ( ((ssize_t) MHD_CONTENT_READER_END_WITH_ERROR) == ret)
+  if (MHD_CONTENT_READER_END_WITH_ERROR == ret)
   {
     /* error, close socket! */
     /* TODO: remove update of the response size */
@@ -1205,7 +1205,7 @@ try_ready_chunked_body (struct MHD_Connection *connection,
                               "Closing connection (application error 
generating response)."));
     return MHD_NO;
   }
-  if (((ssize_t) MHD_CONTENT_READER_END_OF_STREAM) == ret)
+  if (MHD_CONTENT_READER_END_OF_STREAM == ret)
   {
     *p_finished = true;
     /* TODO: remove update of the response size */
@@ -1220,7 +1220,15 @@ try_ready_chunked_body (struct MHD_Connection 
*connection,
 #endif
     return MHD_NO;
   }
-  chunk_hdr_len = MHD_uint32_to_strx (ret, chunk_hdr, sizeof(chunk_hdr));
+  if (size_to_fill < (size_t) ret)
+  {
+    CONNECTION_CLOSE_ERROR (connection,
+                            _ ("Closing connection (application returned " \
+                               "more data than requested)."));
+    return MHD_NO;
+  }
+  chunk_hdr_len = MHD_uint32_to_strx ((uint32_t) ret, chunk_hdr,
+                                      sizeof(chunk_hdr));
   mhd_assert (chunk_hdr_len != 0);
   mhd_assert (chunk_hdr_len < sizeof(chunk_hdr));
   *p_finished = false;
diff --git a/src/microhttpd/mhd_align.h b/src/microhttpd/mhd_align.h
index 47e9f199..a4cba166 100644
--- a/src/microhttpd/mhd_align.h
+++ b/src/microhttpd/mhd_align.h
@@ -42,7 +42,7 @@
 #ifndef _MHD_ALIGNOF
 #if defined(_MSC_VER) && ! defined(__clang__) && _MSC_VER >= 1700
 #define _MHD_ALIGNOF(type) __alignof(type)
-#endif /* _MSC_VER >= 1900 */
+#endif /* _MSC_VER >= 1700 */
 #endif /* !_MHD_ALIGNOF */
 
 #ifdef _MHD_ALIGNOF
diff --git a/src/microhttpd/mhd_mono_clock.c b/src/microhttpd/mhd_mono_clock.c
index 8af998fa..e06f6d16 100644
--- a/src/microhttpd/mhd_mono_clock.c
+++ b/src/microhttpd/mhd_mono_clock.c
@@ -25,10 +25,15 @@
 
 #include "mhd_mono_clock.h"
 
-#if defined(_WIN32) && ! defined(__CYGWIN__) && defined(HAVE_CLOCK_GETTIME)
+#if defined(_WIN32) && ! defined(__CYGWIN__)
 /* Prefer native clock source over wrappers */
+#ifdef HAVE_CLOCK_GETTIME
 #undef HAVE_CLOCK_GETTIME
-#endif /* _WIN32 && ! __CYGWIN__ && HAVE_CLOCK_GETTIME */
+#endif /* HAVE_CLOCK_GETTIME */
+#ifdef HAVE_GETTIMEOFDAY
+#undef HAVE_GETTIMEOFDAY
+#endif /* HAVE_GETTIMEOFDAY */
+#endif /* _WIN32 && ! __CYGWIN__ */
 
 #ifdef HAVE_TIME_H
 #include <time.h>
diff --git a/src/microhttpd/mhd_str.c b/src/microhttpd/mhd_str.c
index 3bbc6f42..473ff466 100644
--- a/src/microhttpd/mhd_str.c
+++ b/src/microhttpd/mhd_str.c
@@ -469,7 +469,7 @@ MHD_str_equal_caseless_bin_n_ (const char *const str1,
  * Token could be surrounded by spaces and tabs and delimited by comma.
  * Match succeed if substring between start, end (of string) or comma
  * contains only case-insensitive token and optional spaces and tabs.
- * @warning token must not contain null-charters except optional
+ * @warning token must not contain null-characters except optional
  *          terminating null-character.
  * @param str the string to check
  * @param token the token to find
diff --git a/src/microhttpd/mhd_str.h b/src/microhttpd/mhd_str.h
index 4a72e35e..43761e3a 100644
--- a/src/microhttpd/mhd_str.h
+++ b/src/microhttpd/mhd_str.h
@@ -125,7 +125,7 @@ MHD_str_equal_caseless_bin_n_ (const char *const str1,
  * Token could be surrounded by spaces and tabs and delimited by comma.
  * Match succeed if substring between start, end of string or comma
  * contains only case-insensitive token and optional spaces and tabs.
- * @warning token must not contain null-charters except optional
+ * @warning token must not contain null-characters except optional
  *          terminating null-character.
  * @param str the string to check
  * @param token the token to find
@@ -384,7 +384,7 @@ MHD_str_to_uvalue_n_ (const char *str,
  * @param val the value to convert
  * @param buf the buffer to result to
  * @param buf_size size of the @a buffer
- * @return number of charters has been put to the @a buf,
+ * @return number of characters has been put to the @a buf,
  *         zero if buffer is too small (buffer may be modified).
  */
 size_t
@@ -400,7 +400,7 @@ MHD_uint32_to_strx (uint32_t val,
  * @param val the value to convert
  * @param buf the buffer to result to
  * @param buf_size size of the @a buffer
- * @return number of charters has been put to the @a buf,
+ * @return number of characters has been put to the @a buf,
  *         zero if buffer is too small (buffer may be modified).
  */
 size_t
@@ -419,7 +419,7 @@ MHD_uint16_to_str (uint16_t val,
  * @param val the value to convert
  * @param buf the buffer to result to
  * @param buf_size size of the @a buffer
- * @return number of charters has been put to the @a buf,
+ * @return number of characters has been put to the @a buf,
  *         zero if buffer is too small (buffer may be modified).
  */
 size_t
@@ -440,7 +440,7 @@ MHD_uint64_to_str (uint64_t val,
  *                   valid values are 3, 2, 1, 0
  * @param buf the buffer to result to
  * @param buf_size size of the @a buffer
- * @return number of charters has been put to the @a buf,
+ * @return number of characters has been put to the @a buf,
  *         zero if buffer is too small (buffer may be modified).
  */
 size_t
diff --git a/src/microhttpd/tsearch.c b/src/microhttpd/tsearch.c
index 26a5c769..ba550b7d 100644
--- a/src/microhttpd/tsearch.c
+++ b/src/microhttpd/tsearch.c
@@ -13,9 +13,10 @@
 #include "tsearch.h"
 #ifdef HAVE_STDDEF_H
 #include <stddef.h>
-#else  /* ! HAVE_STDDEF_H */
-#define NULL ((void*)0)
-#endif /* ! HAVE_STDDEF_H */
+#endif /* HAVE_STDDEF_H */
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif /* HAVE_STDLIB_H */
 
 
 typedef struct node
diff --git a/w32/common/MHD_config.h b/w32/common/MHD_config.h
index 7bbbc4f0..2c51237a 100644
--- a/w32/common/MHD_config.h
+++ b/w32/common/MHD_config.h
@@ -9,13 +9,13 @@
 /* Define if MS VC compiler is used */
 #define MSVC 1
 
-/* Define that MS VC does not support VLAs */
 #ifndef __clang__
+/* Define that MS VC does not support VLAs */
+#ifndef __STDC_NO_VLA__
 #define __STDC_NO_VLA__ 1
-#endif
-
+#endif /* ! __STDC_NO_VLA__ */
+#else
 /* If clang is used then variable-length arrays are supported. */
-#ifdef __clang__
 #define HAVE_C_VARARRAYS 1
 #endif
 
@@ -33,6 +33,31 @@
 #define MHD_HAVE___BUILTIN_BSWAP64 1
 #endif /* __clang__ */
 
+/* The size of `size_t', as computed by sizeof. */
+#if defined(_M_X64) || defined(_M_AMD64) || defined(_M_ARM64) || 
defined(_WIN64)
+#define SIZEOF_SIZE_T 8
+#else  /* ! _WIN64 */
+#define SIZEOF_SIZE_T 4
+#endif /* ! _WIN64 */
+
+/* The size of `tv_sec' member of `struct timeval', as computed by sizeof */
+#define SIZEOF_STRUCT_TIMEVAL_TV_SEC 4
+
+/* The size of `uint64_t', as computed by sizeof. */
+#define SIZEOF_UINT64_T 8
+
+/* The size of `unsigned int', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_INT 4
+
+/* The size of `unsigned long long', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_LONG_LONG 8
+
+/* Define to supported 'noreturn' function declaration */
+#if defined(_STDC_VERSION__) && (__STDC_VERSION__ + 0) >= 201112L
+#define _MHD_NORETURN _Noreturn
+#else  /* before C11 */
+#define _MHD_NORETURN __declspec(noreturn)
+#endif /* before C11 */
 
 /* *** MHD configuration *** */
 /* Undef to disable feature */
@@ -128,6 +153,14 @@
 /* Define to 1 if your compiler supports __func__ magic-macro. */
 #define HAVE___FUNC__ 1
 
+#if _MSC_VER + 0 >= 1900 /* VS 2015 and later */
+#if defined(_STDC_VERSION__) && (__STDC_VERSION__ + 0) >= 201112L
+/* Define to 1 if your compiler supports 'alignof()' */
+#define HAVE_C_ALIGNOF 1
+/* Define to 1 if you have the <stdalign.h> header file. */
+#define HAVE_STDALIGN_H 1
+#endif /* C11 */
+#endif /* VS 2015 and later */
 
 /* *** Headers information *** */
 /* Not really important as not used by code currently */

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