gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (f5d387df -> 466a56e3)


From: gnunet
Subject: [libmicrohttpd] branch master updated (f5d387df -> 466a56e3)
Date: Sun, 15 Aug 2021 14:58:27 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from f5d387df Fix busy waiting up to one second using connection timeout
     new a03cd387 test_callback: improved test
     new 2143696e test_callback: cosmetics
     new 466a56e3 test_get_chunked: set footer when last chunk is being sending

The 3 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/testcurl/test_callback.c    | 52 ++++++++++++++++++++++++-----------------
 src/testcurl/test_get_chunked.c |  8 ++++---
 2 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c
index d9dfecef..5fdfa4b3 100644
--- a/src/testcurl/test_callback.c
+++ b/src/testcurl/test_callback.c
@@ -54,6 +54,7 @@ called_twice (void *cls, uint64_t pos, char *buf, size_t max)
   }
   fprintf (stderr,
            "Handler called after returning END_OF_STREAM!\n");
+  abort ();
   return MHD_CONTENT_READER_END_WITH_ERROR;
 }
 
@@ -170,7 +171,7 @@ main (int argc, char **argv)
   {
     curl_easy_cleanup (c);
     MHD_stop_daemon (d);
-    return 1;
+    return 99;
   }
   mret = curl_multi_add_handle (multi, c);
   if (mret != CURLM_OK)
@@ -178,7 +179,7 @@ main (int argc, char **argv)
     curl_multi_cleanup (multi);
     curl_easy_cleanup (c);
     MHD_stop_daemon (d);
-    return 2;
+    return 99;
   }
   extra = 10;
   while ( (c != NULL) || (--extra > 0) )
@@ -198,7 +199,7 @@ main (int argc, char **argv)
         curl_multi_cleanup (multi);
         curl_easy_cleanup (c);
         MHD_stop_daemon (d);
-        return 3;
+        return 99;
       }
     }
     if (MHD_YES !=
@@ -218,10 +219,8 @@ main (int argc, char **argv)
       if (EINTR != errno)
         abort ();
 #else
-      if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
-                                                                      ws.
-                                                                      fd_count)
-          || (0 != es.fd_count) )
+      if ((WSAEINVAL != WSAGetLastError ()) ||
+          (0 != rs.fd_count) || (0 != ws.fd_count) || (0 != es.fd_count) )
         abort ();
       Sleep (1000);
 #endif
@@ -231,22 +230,33 @@ main (int argc, char **argv)
       curl_multi_perform (multi, &running);
       if (running == 0)
       {
-        msg = curl_multi_info_read (multi, &running);
-        if (msg == NULL)
-          break;
-        if (msg->msg == CURLMSG_DONE)
+        int pending;
+        int curl_fine = 0;
+        while (NULL != (msg = curl_multi_info_read (multi, &pending)))
         {
-          if (msg->data.result != CURLE_OK)
-            printf ("%s failed at %s:%d: `%s'\n",
-                    "curl_multi_perform",
-                    __FILE__,
-                    __LINE__, curl_easy_strerror (msg->data.result));
-          curl_multi_remove_handle (multi, c);
-          curl_multi_cleanup (multi);
-          curl_easy_cleanup (c);
-          c = NULL;
-          multi = NULL;
+          if (msg->msg != CURLMSG_DONE)
+          {
+            if (msg->data.result != CURLE_OK)
+              fprintf (stderr,
+                       "%s failed at %s:%d: `%s'\n",
+                       "curl_multi_perform",
+                       __FILE__,
+                       __LINE__, curl_easy_strerror (msg->data.result));
+            abort ();
+          }
+          else
+            curl_fine = 1;
         }
+        if (! curl_fine)
+        {
+          fprintf (stderr, "libcurl haven't returned OK code\n");
+          abort ();
+        }
+        curl_multi_remove_handle (multi, c);
+        curl_multi_cleanup (multi);
+        curl_easy_cleanup (c);
+        c = NULL;
+        multi = NULL;
       }
     }
     MHD_run (d);
diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c
index 79b0614c..cb46b6dc 100644
--- a/src/testcurl/test_get_chunked.c
+++ b/src/testcurl/test_get_chunked.c
@@ -137,14 +137,16 @@ crc (void *cls,
 {
   struct MHD_Response **responseptr = cls;
 
-  if (resp_empty || (pos == RESP_SIZE))
-  {
+  if (resp_empty || (pos == RESP_SIZE - RESP_BLOCK_SIZE))
+  { /* Add footer with the last block */
     if (MHD_YES != MHD_add_response_footer (*responseptr,
                                             RESP_FOOTER_NAME,
                                             RESP_FOOTER_VALUE))
       abort ();
-    return MHD_CONTENT_READER_END_OF_STREAM;
   }
+  if (resp_empty || (pos == RESP_SIZE))
+    return MHD_CONTENT_READER_END_OF_STREAM;
+
   if (max < RESP_BLOCK_SIZE)
     abort ();                   /* should not happen in this testcase... */
   memset (buf, 'A' + (pos / RESP_BLOCK_SIZE), RESP_BLOCK_SIZE);

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