gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (558a5c86 -> cdb146b8)


From: gnunet
Subject: [libmicrohttpd] branch master updated (558a5c86 -> cdb146b8)
Date: Thu, 08 Oct 2020 15:39:31 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 558a5c86 setup_epoll_to_listen: do add ITC when have no listen socket
     new e58fbba0 internal_add_connection: refuse blocking sockets in epoll mode
     new cdb146b8 cosmetic fixes

The 2 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:
 src/examples/chunked_example.c         |  7 +++++--
 src/microhttpd/connection.c            | 17 ++++++++++-------
 src/microhttpd/daemon.c                | 31 +++++++++++++++++++++++--------
 src/microhttpd/digestauth.c            | 14 +++++++++-----
 src/microhttpd/mhd_send.c              |  3 ++-
 src/microhttpd/mhd_threads.c           |  6 ++++--
 src/microhttpd/postprocessor.c         |  3 ++-
 src/microhttpd/test_postprocessor_md.c |  2 +-
 src/microhttpd/test_upgrade.c          |  3 ++-
 src/microhttpd/test_upgrade_large.c    |  3 ++-
 src/testcurl/curl_version_check.c      |  3 ++-
 src/testcurl/perf_get.c                |  3 ++-
 12 files changed, 64 insertions(+), 31 deletions(-)

diff --git a/src/examples/chunked_example.c b/src/examples/chunked_example.c
index bd4eb855..6f449c3a 100644
--- a/src/examples/chunked_example.c
+++ b/src/examples/chunked_example.c
@@ -57,7 +57,8 @@ callback (void *cls,
       // Consider suspending connection until data will be ready.
       return 0;
     }
-   * End of pseudo code. */if (buf_size < (param->response_size - pos))
+   * End of pseudo code. */
+  if (buf_size < (param->response_size - pos))
     size_to_copy = buf_size;
   else
     size_to_copy = param->response_size - pos;
@@ -70,7 +71,9 @@ callback (void *cls,
       // Close connection with error.
       return MHD_CONTENT_READER_END_WITH_ERROR;
     }
-   * End of pseudo code. *//* Return amount of data copied to buffer. */return 
size_to_copy;
+   * End of pseudo code. */
+  /* Return amount of data copied to buffer. */
+  return size_to_copy;
 }
 
 
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 21f5a651..2d9dd9a9 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -656,7 +656,8 @@ MHD_connection_mark_closed_ (struct MHD_Connection 
*connection)
      * and do not shutdown TCP socket. This give more
      * chances to send TLS closure data to remote side.
      * Closure of TLS layer will be interpreted by
-     * remote side as end of transmission. */if (0 != (daemon->options & 
MHD_USE_TLS))
+     * remote side as end of transmission. */
+    if (0 != (daemon->options & MHD_USE_TLS))
     {
       if (! MHD_tls_connection_shutdown (connection))
         shutdown (connection->socket_fd,
@@ -763,7 +764,7 @@ MHD_connection_finish_forward_ (struct MHD_Connection 
*connection)
    * used with MHD_UPGRADE_ACTION_CLOSE. They will be
    * closed by MHD_cleanup_upgraded_connection_() during
    * connection's final cleanup.
-   *///
+   */
 }
 
 
@@ -1177,7 +1178,7 @@ try_grow_read_buffer (struct MHD_Connection *connection,
        the right position in the pool, say because someone called
        MHD_pool_allocate() without 'from_end' set to 'true'? Anyway,
        should be investigated! (Ideally provide all data from
-       *pool and connection->read_buffer and new_size for debugging). *///
+       *pool and connection->read_buffer and new_size for debugging). */
     mhd_assert (0);
     return false;
   }
@@ -1403,7 +1404,7 @@ build_header_response (struct MHD_Connection *connection)
 
         Note that the change from 'SHOULD NOT' to 'MUST NOT' is
         a recent development of the HTTP 1.1 specification.
-      *///
+      */
       content_length_len
         = MHD_snprintf_ (content_length_buf,
                          sizeof (content_length_buf),
@@ -1737,7 +1738,8 @@ MHD_connection_update_event_loop_info (struct 
MHD_Connection *connection)
              or if we do nothing, we would just timeout
              on the connection (if a timeout is even
              set!).
-             Solution: we kill the connection with an error 
*/transmit_error_response (connection,
+             Solution: we kill the connection with an error */
+          transmit_error_response (connection,
                                    MHD_HTTP_INTERNAL_SERVER_ERROR,
                                    INTERNAL_ERROR);
           continue;
@@ -2511,7 +2513,8 @@ process_header_line (struct MHD_Connection *connection,
      header at the beginning of the while
      loop since we need to be able to inspect
      the *next* header line (in case it starts
-     with a space...) */connection->last = line;
+     with a space...) */
+  connection->last = line;
   connection->colon = colon;
   return MHD_YES;
 }
@@ -2558,7 +2561,7 @@ process_broken_line (struct MHD_Connection *connection,
  adjacency); also, in the case where these are not adjacent
  (not sure how it can happen!), we would want to allocate from
  the end of the pool, so as to not destroy the read-buffer's
- ability to grow nicely. *///
+ ability to grow nicely. */
     last = MHD_pool_reallocate (connection->pool,
                                 last,
                                 last_len + 1,
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 42c21b6c..48434112 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1232,8 +1232,10 @@ call_handlers (struct MHD_Connection *con,
      immediately.
      As writeability of socket was not checked and it may have
      some data pending in system buffers, use this optimization
-     only for non-blocking sockets. *//* No need to check 'ret' as connection 
is always in
-   * MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */else if 
(on_fasttrack && con->sk_nonblck)
+     only for non-blocking sockets. */
+  /* No need to check 'ret' as connection is always in
+   * MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */
+  else if (on_fasttrack && con->sk_nonblck)
   {
     if (MHD_CONNECTION_HEADERS_SENDING == con->state)
     {
@@ -1367,7 +1369,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
      * check for any pending data even if socket is not marked
      * as 'ready' (signal may arrive after poll()/select()).
      * Socketpair for forwarding is always in non-blocking mode
-     * so no risk that recv() will block the thread. *///
+     * so no risk that recv() will block the thread. */
     if (0 != urh->out_buffer_size)
       urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY;
     /* Discard any data received form remote. */
@@ -1386,7 +1388,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
    * trying send() on any socket, recv() must be performed at first otherwise
    * last part of incoming data may be lost.  If disconnect or error was
    * detected - try to read from socket to dry data possibly pending is system
-   * buffers. *///
+   * buffers. */
   if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi))
     urh->app.celi |= MHD_EPOLL_STATE_READ_READY;
   if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi))
@@ -2404,9 +2406,8 @@ internal_add_connection (struct MHD_Daemon *daemon,
   }
 #endif
 
-  if ( (! MHD_SCKT_FD_FITS_FDSET_ (client_socket,
-                                   NULL)) &&
-       (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL))) )
+  if ( (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL))) &&
+       (! MHD_SCKT_FD_FITS_FDSET_ (client_socket, NULL)) )
   {
 #ifdef HAVE_MESSAGES
     MHD_DLOG (daemon,
@@ -2415,6 +2416,20 @@ internal_add_connection (struct MHD_Daemon *daemon,
               (int) FD_SETSIZE);
 #endif
     MHD_socket_close_chk_ (client_socket);
+#if ENFILE
+    errno = ENFILE;
+#endif
+    return MHD_NO;
+  }
+
+  if ( (0 == (daemon->options & MHD_USE_EPOLL)) &&
+       (! non_blck) )
+  {
+#ifdef HAVE_MESSAGES
+    MHD_DLOG (daemon,
+              _ ("Epoll mode supports only non-blocking sockets\n"));
+#endif
+    MHD_socket_close_chk_ (client_socket);
 #if EINVAL
     errno = EINVAL;
 #endif
@@ -3383,7 +3398,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
            this is not true as if we fail to do manually remove it,
            we are still seeing an event for this fd in epoll,
            causing grief (use-after-free...) --- at least on my
-           system. *///
+           system. */
         if (0 != epoll_ctl (daemon->epoll_fd,
                             EPOLL_CTL_DEL,
                             pos->socket_fd,
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 3949b268..b2944fad 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -555,7 +555,8 @@ check_nonce_nc (struct MHD_Connection *connection,
    * Look for the nonce, if it does exist and its corresponding
    * nonce counter is less than the current nonce counter by 1,
    * then only increase the nonce counter by one.
-   */nn = &daemon->nnc[off];
+   */
+  nn = &daemon->nnc[off];
 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
   MHD_mutex_lock_chk_ (&daemon->nnc_lock);
 #endif
@@ -955,7 +956,8 @@ digest_auth_check_all (struct MHD_Connection *connection,
    * First level vetting for the nonce validity: if the timestamp
    * attached to the nonce exceeds `nonce_timeout', then the nonce is
    * invalid.
-   */if ( (t > nonce_time + nonce_timeout) ||
+   */
+  if ( (t > nonce_time + nonce_timeout) ||
        (nonce_time + nonce_timeout < nonce_time) )
   {
     /* too old */
@@ -978,7 +980,8 @@ digest_auth_check_all (struct MHD_Connection *connection,
    * able to generate a "sane" nonce, which if he does
    * not, the nonce fabrication process going to be
    * very hard to achieve.
-   */if (0 != strcmp (nonce,
+   */
+  if (0 != strcmp (nonce,
                    noncehashexp))
   {
     return MHD_INVALID_NONCE;
@@ -1025,7 +1028,8 @@ digest_auth_check_all (struct MHD_Connection *connection,
    * Checking if that combination of nonce and nc is sound
    * and not a replay attack attempt. Also adds the nonce
    * to the nonce-nc map if it does not exist there.
-   */if (MHD_NO ==
+   */
+  if (MHD_NO ==
       check_nonce_nc (connection,
                       nonce,
                       nci))
@@ -1199,7 +1203,7 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
       da.digest = &MHD_MD5Final;                        \
       break;                                        \
     case MHD_DIGEST_ALG_AUTO:                             \
-    /* auto == SHA256, fall-though thus intentional! */ \
+  /* auto == SHA256, fall-though thus intentional! */ \
     case MHD_DIGEST_ALG_SHA256:                           \
       da.digest_size = SHA256_DIGEST_SIZE;                \
       da.ctx = &ctx.sha256;                               \
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 339dad2b..335aa13a 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -584,7 +584,8 @@ MHD_send_sendfile_ (struct MHD_Connection *connection)
        supported for FD or other 'unusual' errors occurred, so we should try
        to fall back to 'SEND'; see also this thread for info on
        odd libc/Linux behavior with sendfile:
-       http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html 
*/connection->resp_sender = MHD_resp_sender_std;
+       http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */
+    connection->resp_sender = MHD_resp_sender_std;
     return MHD_ERR_AGAIN_;
 #else  /* HAVE_SOLARIS_SENDFILE */
     if ( (EAFNOSUPPORT == err) ||
diff --git a/src/microhttpd/mhd_threads.c b/src/microhttpd/mhd_threads.c
index aa0ad571..3a63cff1 100644
--- a/src/microhttpd/mhd_threads.c
+++ b/src/microhttpd/mhd_threads.c
@@ -81,7 +81,8 @@ MHD_set_thread_name_ (const MHD_thread_ID_ thread_id,
    *                         third argument is single argument for printf;
    * OSF1 use 3 arguments too, but last one always must be zero (NULL).
    * MHD doesn't use '%' in thread names, so both form are used in same way.
-   */return ! pthread_setname_np (thread_id, thread_name, 0);
+   */
+  return ! pthread_setname_np (thread_id, thread_name, 0);
 #endif /* HAVE_PTHREAD_SETNAME_NP_NETBSD */
 }
 
@@ -311,7 +312,8 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
      *                         third argument is single argument for printf;
      * OSF1 use 3 arguments too, but last one always must be zero (NULL).
      * MHD doesn't use '%' in thread names, so both form are used in same way.
-     */res = pthread_attr_setname_np (&attr,
+     */
+    res = pthread_attr_setname_np (&attr,
                                    thread_name,
                                    0);
 #elif defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI)
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index eda1ae51..b9e93b8c 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -1212,7 +1212,8 @@ post_process_multipart (struct MHD_PostProcessor *pp,
        * > generally be left blank, and implementations must ignore
        * > anything that appears before the first boundary delimiter
        * > line or after the last one.
-       */(void) find_boundary (pp,
+       */
+      (void) find_boundary (pp,
                             pp->boundary,
                             pp->blen,
                             &ioff,
diff --git a/src/microhttpd/test_postprocessor_md.c 
b/src/microhttpd/test_postprocessor_md.c
index 82093d3c..2d1cae61 100644
--- a/src/microhttpd/test_postprocessor_md.c
+++ b/src/microhttpd/test_postprocessor_md.c
@@ -301,7 +301,7 @@ main (int argc, char *argv[])
     postprocessor->skip_rn = RN_Inactive;
     const char *chunks[] = {
       
"t=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%2C%2Cxxxxx%2C%2Cx%2Cxxxxxxxxxxxxxxxxxxxx%2C%2Cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%2Cxxxxxxxx%2Cxxxxxxxxxxxxxxxx%2Cxxxxx%2Cxxxxxxx%2C%2Cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%2C%2Cxx%2C%2Cx%2Cxx%2C%2Cxxxx%2Cxxx%2C%2Cx%2C%2C%2C%2Cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%2Cxxxxxxxxxxxxxxxxxxxxx
 [...]
-      // one chunk: second line is dropped
+      /* one chunk: second line is dropped */
       
"yyyyyyyyyyyyyyyyyyyyyyyyyyyyyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%2Cxxxxxxxxxxxxxxxx%2Cx%2C%2Cx%2Cxxxxxxxxxxxxxxxxxxx%2C%2C%2C%2C%2C%2Cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%2Cxxxxxxxxxx%2C%2C%2Cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%2Cxxxxxxxxxxxxxxxxxxx%2Cxxxx%2Cxxxxxxxxxxxxxxxxx%2Cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%2C%2C%2
 [...]
       
"%E2%80%A2MMMMMMMM%2C%2C%2C%2CMMMMMMMMMMMMMMMMMMMM%2CMMMMMMMMMMMMMMMMMMMMMMM%2CMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM%2C%2C%2C%2CMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM%2CMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM%2CM
 [...]
       "zz",
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index fd9c2537..84585196 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -298,7 +298,8 @@ wr_connect (struct wr_socket *s,
      * it require processing on MHD side and
      * when testing with "external" polling,
      * test will call MHD processing only
-     * after return from wr_connect(). */s->tls_connected = 0;
+     * after return from wr_connect(). */
+    s->tls_connected = 0;
     return 0;
   }
 #endif /* HTTPS_SUPPORT */
diff --git a/src/microhttpd/test_upgrade_large.c 
b/src/microhttpd/test_upgrade_large.c
index fb60ddd8..5199d187 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -463,7 +463,8 @@ wr_connect (struct wr_socket *s,
      * it require processing on MHD side and
      * when testing with "external" polling,
      * test will call MHD processing only
-     * after return from wr_connect(). */s->tls_connected = 0;
+     * after return from wr_connect(). */
+    s->tls_connected = 0;
     return 0;
   }
 #endif /* HTTPS_SUPPORT */
diff --git a/src/testcurl/curl_version_check.c 
b/src/testcurl/curl_version_check.c
index 445c85d7..315c50ce 100644
--- a/src/testcurl/curl_version_check.c
+++ b/src/testcurl/curl_version_check.c
@@ -103,7 +103,8 @@ curl_check_version (const char *req_version)
    * this call relies on the cURL string to be of the exact following format :
    * 'libcurl/7.16.4 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/0.6.5' OR
    * 'libcurl/7.18.2 GnuTLS/2.4.0 zlib/1.2.3.3 libidn/0.6.5'
-   */curl_ver = strchr (ver, '/');
+   */
+  curl_ver = strchr (ver, '/');
   if (curl_ver == NULL)
     return -1;
   curl_ver++;
diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c
index eb33ea0c..4a903e39 100644
--- a/src/testcurl/perf_get.c
+++ b/src/testcurl/perf_get.c
@@ -569,7 +569,8 @@ testExternalGet (int port)
          in actual runtime right now, even though the
          number of select calls is virtually cut in half
          (and 'select' is the most expensive of our system
-         calls according to 'strace') */if (0)
+         calls according to 'strace') */
+      if (0)
         MHD_run (d);
       else
         MHD_run_from_select (d, &rs, &ws, &es);

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