diff --git a/lib/core/libwebsockets.c b/lib/core/libwebsockets.c index 4c095aec8..2cca7ba3e 100644 --- a/lib/core/libwebsockets.c +++ b/lib/core/libwebsockets.c @@ -888,7 +888,9 @@ just_kill_connection: /* tell the user it's all over for this guy */ - if (lwsi_state_est_PRE_CLOSE(wsi) && !wsi->told_user_closed && + if ((lwsi_state_est_PRE_CLOSE(wsi) || + lwsi_state_PRE_CLOSE(wsi) == LRS_WAITING_SERVER_REPLY) && + !wsi->told_user_closed && wsi->role_ops->close_cb[lwsi_role_server(wsi)]) { const struct lws_protocols *pro = wsi->protocol; diff --git a/lib/roles/http/client/client.c b/lib/roles/http/client/client.c index 8aba185b8..d80c64a04 100644 --- a/lib/roles/http/client/client.c +++ b/lib/roles/http/client/client.c @@ -549,11 +549,12 @@ lws_http_transaction_completed_client(struct lws *wsi) { struct lws *wsi_eff = lws_client_wsi_effective(wsi); - lwsl_info("%s: wsi: %p, wsi_eff: %p\n", __func__, wsi, wsi_eff); + lwsl_info("%s: wsi: %p, wsi_eff: %p (%s)\n", __func__, wsi, wsi_eff, + wsi_eff->protocol->name); - if (user_callback_handle_rxflow(wsi_eff->protocol->callback, - wsi_eff, LWS_CALLBACK_COMPLETED_CLIENT_HTTP, - wsi_eff->user_space, NULL, 0)) { + if (user_callback_handle_rxflow(wsi_eff->protocol->callback, wsi_eff, + LWS_CALLBACK_COMPLETED_CLIENT_HTTP, + wsi_eff->user_space, NULL, 0)) { lwsl_debug("%s: Completed call returned nonzero (role 0x%x)\n", __func__, lwsi_role(wsi_eff)); return -1;