gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 02/09: test_upgrade{,_large}: minor improvements


From: gnunet
Subject: [libmicrohttpd] 02/09: test_upgrade{,_large}: minor improvements
Date: Fri, 24 Nov 2023 19:53:57 +0100

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 1cf76efe80f6ad2ee670660b78ee494495079cef
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Oct 9 16:14:39 2023 +0300

    test_upgrade{,_large}: minor improvements
---
 src/microhttpd/test_upgrade.c       | 27 ++++++++++++++++++++++++++-
 src/microhttpd/test_upgrade_large.c | 27 ++++++++++++++++++++++++++-
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index 22b15090..061b1af2 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -463,6 +463,13 @@ wr_handshake (struct wr_socket *s)
     MHD_socket_set_error_ (MHD_SCKT_EAGAIN_);
   else
   {
+    fprintf (stderr, "The error returned by gnutls_handshake() is "
+             "'%s' ", gnutls_strerror ((int) res));
+#if GNUTLS_VERSION_NUMBER >= 0x020600
+    fprintf (stderr, "(%s)\n", gnutls_strerror_name ((int) res));
+#else  /* GNUTLS_VERSION_NUMBER < 0x020600 */
+    fprintf (stderr, "(%d)\n", (int) res);
+#endif /* GNUTLS_VERSION_NUMBER < 0x020600 */
     testErrorLogDesc ("gnutls_handshake() failed with hard error");
     MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */
   }
@@ -503,6 +510,13 @@ wr_send (struct wr_socket *s,
       MHD_socket_set_error_ (MHD_SCKT_EAGAIN_);
     else
     {
+      fprintf (stderr, "The error returned by gnutls_record_send() is "
+               "'%s' ", gnutls_strerror ((int) ret));
+#if GNUTLS_VERSION_NUMBER >= 0x020600
+      fprintf (stderr, "(%s)\n", gnutls_strerror_name ((int) ret));
+#else  /* GNUTLS_VERSION_NUMBER < 0x020600 */
+      fprintf (stderr, "(%d)\n", (int) ret);
+#endif /* GNUTLS_VERSION_NUMBER < 0x020600 */
       testErrorLogDesc ("gnutls_record_send() failed with hard error");
       MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_);   /* hard error */
       return -1;
@@ -539,12 +553,19 @@ wr_recv (struct wr_socket *s,
       return -1;
 
     ret = gnutls_record_recv (s->tls_s, buf, len);
-    if (ret > 0)
+    if (ret >= 0)
       return ret;
     if (GNUTLS_E_AGAIN == ret)
       MHD_socket_set_error_ (MHD_SCKT_EAGAIN_);
     else
     {
+      fprintf (stderr, "The error returned by gnutls_record_recv() is "
+               "'%s' ", gnutls_strerror ((int) ret));
+#if GNUTLS_VERSION_NUMBER >= 0x020600
+      fprintf (stderr, "(%s)\n", gnutls_strerror_name ((int) ret));
+#else  /* GNUTLS_VERSION_NUMBER < 0x020600 */
+      fprintf (stderr, "(%d)\n", (int) ret);
+#endif /* GNUTLS_VERSION_NUMBER < 0x020600 */
       testErrorLogDesc ("gnutls_record_recv() failed with hard error");
       MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_);   /* hard error */
       return -1;
@@ -873,7 +894,11 @@ recv_all (struct wr_socket *sock,
       externalErrorExitDesc ("recv() failed");
     }
     if (0 == ret)
+    {
+      fprintf (stderr, "Partial only received text. Expected: '%s' ."
+               "Got: '%.*s'. ", text, (int) (off + (size_t) ret), buf);
       mhdErrorExitDesc ("The server unexpectedly closed connection");
+    }
   }
   if (0 != strncmp (text, buf, len))
   {
diff --git a/src/microhttpd/test_upgrade_large.c 
b/src/microhttpd/test_upgrade_large.c
index 9a99c6d4..e7f842d1 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -629,6 +629,13 @@ wr_handshake (struct wr_socket *s)
     MHD_socket_set_error_ (MHD_SCKT_EAGAIN_);
   else
   {
+    fprintf (stderr, "The error returned by gnutls_handshake() is "
+             "'%s' ", gnutls_strerror ((int) res));
+#if GNUTLS_VERSION_NUMBER >= 0x020600
+    fprintf (stderr, "(%s)\n", gnutls_strerror_name ((int) res));
+#else  /* GNUTLS_VERSION_NUMBER < 0x020600 */
+    fprintf (stderr, "(%d)\n", (int) res);
+#endif /* GNUTLS_VERSION_NUMBER < 0x020600 */
     testErrorLogDesc ("gnutls_handshake() failed with hard error");
     MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */
   }
@@ -671,6 +678,13 @@ wr_send (struct wr_socket *s,
       MHD_socket_set_error_ (MHD_SCKT_EAGAIN_);
     else
     {
+      fprintf (stderr, "The error returned by gnutls_record_send() is "
+               "'%s' ", gnutls_strerror ((int) ret));
+#if GNUTLS_VERSION_NUMBER >= 0x020600
+      fprintf (stderr, "(%s)\n", gnutls_strerror_name ((int) ret));
+#else  /* GNUTLS_VERSION_NUMBER < 0x020600 */
+      fprintf (stderr, "(%d)\n", (int) ret);
+#endif /* GNUTLS_VERSION_NUMBER < 0x020600 */
       testErrorLogDesc ("gnutls_record_send() failed with hard error");
       MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_);  /* hard error */
       return -1;
@@ -707,12 +721,19 @@ wr_recv (struct wr_socket *s,
       return -1;
 
     ret = gnutls_record_recv (s->tls_s, buf, len);
-    if (ret > 0)
+    if (ret >= 0)
       return ret;
     if (GNUTLS_E_AGAIN == ret)
       MHD_socket_set_error_ (MHD_SCKT_EAGAIN_);
     else
     {
+      fprintf (stderr, "The error returned by gnutls_record_recv() is "
+               "'%s' ", gnutls_strerror ((int) ret));
+#if GNUTLS_VERSION_NUMBER >= 0x020600
+      fprintf (stderr, "(%s)\n", gnutls_strerror_name ((int) ret));
+#else  /* GNUTLS_VERSION_NUMBER < 0x020600 */
+      fprintf (stderr, "(%d)\n", (int) ret);
+#endif /* GNUTLS_VERSION_NUMBER < 0x020600 */
       testErrorLogDesc ("gnutls_record_recv() failed with hard error");
       MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_);  /* hard error */
       return -1;
@@ -1050,7 +1071,11 @@ recv_all (struct wr_socket *sock,
       externalErrorExitDesc ("recv() failed");
     }
     if (0 == ret)
+    {
+      fprintf (stderr, "Partial only received text. Expected: '%s' ."
+               "Got: '%.*s'. ", text, (int) (off + (size_t) ret), buf);
       mhdErrorExitDesc ("The server unexpectedly closed connection");
+    }
     if (0 != strncmp (text, buf, off + (size_t) ret))
     {
       fprintf (stderr, "Wrong received text. Expected: '%s' ."

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