diff --git a/lib/roles/http/client/client-http.c b/lib/roles/http/client/client-http.c index 1aab99925..1784bc6ce 100644 --- a/lib/roles/http/client/client-http.c +++ b/lib/roles/http/client/client-http.c @@ -1425,13 +1425,16 @@ spin_chunks: !!wsi->protocol_bind_balance #endif ) { - if (user_callback_handle_rxflow(wsi->a.protocol->callback, - wsi, LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ, - wsi->user_space, *buf, n)) { - lwsl_info("%s: RECEIVE_CLIENT_HTTP_READ returned -1\n", - __func__); + int q; - return -1; + q = user_callback_handle_rxflow(wsi->a.protocol->callback, + wsi, LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ, + wsi->user_space, *buf, n); + if (q) { + lwsl_info("%s: RECEIVE_CLIENT_HTTP_READ returned %d\n", + __func__, q); + + return q; } } else lwsl_notice("%s: swallowed read (%d)\n", __func__, n); diff --git a/lib/secure-streams/protocols/ss-h1.c b/lib/secure-streams/protocols/ss-h1.c index 36fa71173..f76cf3194 100644 --- a/lib/secure-streams/protocols/ss-h1.c +++ b/lib/secure-streams/protocols/ss-h1.c @@ -431,7 +431,10 @@ malformed: // lwsl_notice("%s: HTTP_READ: client side sent len %d fl 0x%x\n", // __func__, (int)len, (int)f); - if (h->info.rx(ss_to_userobj(h), (const uint8_t *)in, len, f) < 0) + m = h->info.rx(ss_to_userobj(h), (const uint8_t *)in, len, f); + if (m == LWSSSSRET_DESTROY_ME) + goto do_destroy_me; + if (m < 0) return -1; return 0; /* don't passthru */ @@ -501,6 +504,7 @@ malformed: return -1; /* close connection */ case LWSSSSRET_DESTROY_ME: +do_destroy_me: lws_set_opaque_user_data(wsi, NULL); h->wsi = NULL; lws_ss_destroy(&h);