[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 01/05: test_client_put_stop: check for right reason
From: |
gnunet |
Subject: |
[libmicrohttpd] 01/05: test_client_put_stop: check for right reason |
Date: |
Sun, 28 Nov 2021 17:44:34 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 5c478c5d61b06ebd581d18c28e3906b1e7e2101b
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Nov 28 13:21:53 2021 +0300
test_client_put_stop: check for right reason
The termination reason must correspond to type of client socket closure.
---
src/microhttpd/test_client_put_stop.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/microhttpd/test_client_put_stop.c
b/src/microhttpd/test_client_put_stop.c
index ce197190..2c903f27 100644
--- a/src/microhttpd/test_client_put_stop.c
+++ b/src/microhttpd/test_client_put_stop.c
@@ -1384,8 +1384,11 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
int ret = 0; /* Return value */
size_t req_total_size;
size_t limit_send_size;
+ int expected_reason;
+ int found_right_reason;
- /* Common parameters, to be individually overridden by specific test cases */
+ /* Common parameters, to be individually overridden by specific test cases
+ * if needed */
qParam.queryPort = d_port;
qParam.method = MHD_HTTP_METHOD_PUT;
qParam.queryPath = EXPECTED_URI_BASE_PATH;
@@ -1415,6 +1418,10 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
_MHD_dumbClient_close (test_c);
} while (0);
+ expected_reason = use_hard_close ?
+ MHD_REQUEST_TERMINATED_READ_ERROR :
+ MHD_REQUEST_TERMINATED_CLIENT_ABORT;
+ found_right_reason = 0;
for (limit_send_size = 1; limit_send_size < req_total_size;
limit_send_size++)
{
int test_succeed;
@@ -1452,7 +1459,11 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
else if (1 != sckt_result->num_finished)
fprintf (stderr, "FAILED: Wrong number of sockets closed.");
else
+ {
test_succeed = 1;
+ if (expected_reason == term_result->term_reason)
+ found_right_reason = 1;
+ }
}
if (! test_succeed)
@@ -1477,6 +1488,14 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
free (term_result);
free (sckt_result);
+ if (! found_right_reason)
+ {
+ fprintf (stderr, "FAILED: termination callback was not called with "
+ "expected (%s) reason.\n", term_reason_str (expected_reason));
+ fflush (stderr);
+ ret |= 1 << 1;
+ }
+
return ret;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (cca1730f -> ff12c572), gnunet, 2021/11/28
- [libmicrohttpd] 02/05: Cosmetics: removed duplicated value, gnunet, 2021/11/28
- [libmicrohttpd] 01/05: test_client_put_stop: check for right reason,
gnunet <=
- [libmicrohttpd] 04/05: Fixed MHD_FEATURE_AUTOSUPPRESS_SIGPIPE return value, gnunet, 2021/11/28
- [libmicrohttpd] 05/05: test_client_put_stop: suppress SIGPIPE on the client side, gnunet, 2021/11/28
- [libmicrohttpd] 03/05: If socket error is detected, try to detect the type of error before closing, gnunet, 2021/11/28