Skip to content

Commit 8a22cc0

Browse files
committed
ctest: more reliability meddling
1 parent 450a8f3 commit 8a22cc0

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

lib/roles/h2/http2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2594,6 +2594,8 @@ lws_h2_client_handshake(struct lws *wsi)
25942594
n--;
25952595
}
25962596

2597+
lwsl_hexdump_notice(path, (size_t)n);
2598+
25972599
if (n && lws_add_http_header_by_token(wsi,
25982600
WSI_TOKEN_HTTP_COLON_PATH,
25992601
(unsigned char *)path, n, &p, end))

lib/secure-streams/protocols/ss-h1.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,9 @@ secstream_connect_munge_h1(lws_ss_handle_t *h, char *buf, size_t len,
12201220
&used_in, &used_out) != LSTRX_DONE)
12211221
return 1;
12221222

1223+
if (used_out + 1 < len - 1)
1224+
buf[used_out + 1] = '\0';
1225+
12231226
return 0;
12241227
}
12251228

minimal-examples-lowlevel/secure-streams/minimal-secure-streams-hugeurl/minimal-secure-streams.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static const char * const default_ss_policy =
9595
"\"hugearg\":" "\"\""
9696
"}],"
9797
"\"tls\":" "true,"
98-
"\"opportunistic\":" "true,"
98+
// "\"opportunistic\":" "true,"
9999
"\"retry\":" "\"default\","
100100
"\"tls_trust_store\":" "\"arca1\""
101101
"}},{"
@@ -111,7 +111,7 @@ static const char * const default_ss_policy =
111111
"\"hugearg\":" "\"\""
112112
"}],"
113113
"\"tls\":" "true,"
114-
"\"opportunistic\":" "true,"
114+
// "\"opportunistic\":" "true,"
115115
"\"retry\":" "\"default\","
116116
"\"tls_trust_store\":" "\"arca1\""
117117
"}},{"
@@ -395,6 +395,8 @@ int main(int argc, const char **argv)
395395
LWS_SERVER_OPTION_H2_JUST_FIX_WINDOW_UPDATE_OVERFLOW |
396396
LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
397397
#endif
398+
info.connect_timeout_secs = 15; /* httpbin.org seems to need this depending on time of day */
399+
info.timeout_secs = 10;
398400

399401
if (lws_cmdline_option(argc, argv, "--h1"))
400402
h1 = 1;

minimal-examples-lowlevel/secure-streams/minimal-secure-streams-testsfail/minimal-secure-streams-testsfail.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <string.h>
1919
#include <signal.h>
2020

21-
static int interrupted, tests, tests_pass, tests_fail;
21+
static int interrupted, tests, tests_pass, tests_fail, doing_a_retry;
2222
static lws_sorted_usec_list_t sul_next_test;
2323
static lws_state_notify_link_t nl;
2424
struct lws_context *context;
@@ -642,6 +642,18 @@ myss_state(void *userobj, void *sh, lws_ss_constate_t state,
642642
lws_ss_state_name((int)state), state, (unsigned int)ack);
643643

644644
if (curr_test->mask_unexpected & (1u << state)) {
645+
646+
if (state == LWSSSCS_QOS_NACK_REMOTE) {
647+
648+
lwsl_user("%s: retrying it due to getting NACK\n", __func__);
649+
650+
doing_a_retry = 1;
651+
/* Since this can be the remote server denying it, retry it */
652+
lws_sul_schedule(context, 0, &sul_next_test, tests_start_next, 1000);
653+
654+
return LWSSSSRET_OK;
655+
}
656+
645657
/*
646658
* We have definitively failed on an unexpected state received
647659
*/
@@ -690,7 +702,7 @@ myss_state(void *userobj, void *sh, lws_ss_constate_t state,
690702
return lws_ss_client_connect(m->ss);
691703

692704
case LWSSSCS_DESTROYING:
693-
if (!m->result_reported) {
705+
if (!m->result_reported && !doing_a_retry) {
694706
lwsl_user("%s: failing on unexpected destruction\n",
695707
__func__);
696708

@@ -721,6 +733,8 @@ tests_start_next(lws_sorted_usec_list_t *sul)
721733
lws_ss_destroy(&h);
722734
}
723735

736+
doing_a_retry = 0;
737+
724738
if ((unsigned int)tests >= LWS_ARRAY_SIZE(tests_seq)) {
725739
lwsl_notice("Completed all tests\n");
726740
interrupted = 1;

0 commit comments

Comments
 (0)