aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/test_client_put_stop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/test_client_put_stop.c')
-rw-r--r--src/microhttpd/test_client_put_stop.c21
1 files changed, 20 insertions, 1 deletions
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,
1384 int ret = 0; /* Return value */ 1384 int ret = 0; /* Return value */
1385 size_t req_total_size; 1385 size_t req_total_size;
1386 size_t limit_send_size; 1386 size_t limit_send_size;
1387 int expected_reason;
1388 int found_right_reason;
1387 1389
1388 /* Common parameters, to be individually overridden by specific test cases */ 1390 /* Common parameters, to be individually overridden by specific test cases
1391 * if needed */
1389 qParam.queryPort = d_port; 1392 qParam.queryPort = d_port;
1390 qParam.method = MHD_HTTP_METHOD_PUT; 1393 qParam.method = MHD_HTTP_METHOD_PUT;
1391 qParam.queryPath = EXPECTED_URI_BASE_PATH; 1394 qParam.queryPath = EXPECTED_URI_BASE_PATH;
@@ -1415,6 +1418,10 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
1415 _MHD_dumbClient_close (test_c); 1418 _MHD_dumbClient_close (test_c);
1416 } while (0); 1419 } while (0);
1417 1420
1421 expected_reason = use_hard_close ?
1422 MHD_REQUEST_TERMINATED_READ_ERROR :
1423 MHD_REQUEST_TERMINATED_CLIENT_ABORT;
1424 found_right_reason = 0;
1418 for (limit_send_size = 1; limit_send_size < req_total_size; limit_send_size++) 1425 for (limit_send_size = 1; limit_send_size < req_total_size; limit_send_size++)
1419 { 1426 {
1420 int test_succeed; 1427 int test_succeed;
@@ -1452,7 +1459,11 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
1452 else if (1 != sckt_result->num_finished) 1459 else if (1 != sckt_result->num_finished)
1453 fprintf (stderr, "FAILED: Wrong number of sockets closed."); 1460 fprintf (stderr, "FAILED: Wrong number of sockets closed.");
1454 else 1461 else
1462 {
1455 test_succeed = 1; 1463 test_succeed = 1;
1464 if (expected_reason == term_result->term_reason)
1465 found_right_reason = 1;
1466 }
1456 } 1467 }
1457 1468
1458 if (! test_succeed) 1469 if (! test_succeed)
@@ -1477,6 +1488,14 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
1477 free (term_result); 1488 free (term_result);
1478 free (sckt_result); 1489 free (sckt_result);
1479 1490
1491 if (! found_right_reason)
1492 {
1493 fprintf (stderr, "FAILED: termination callback was not called with "
1494 "expected (%s) reason.\n", term_reason_str (expected_reason));
1495 fflush (stderr);
1496 ret |= 1 << 1;
1497 }
1498
1480 return ret; 1499 return ret;
1481} 1500}
1482 1501