fix for https connection code
This commit is contained in:
parent
499954a096
commit
8d4c673d02
2 changed files with 12 additions and 4 deletions
4
lib/client.c
Normal file → Executable file
4
lib/client.c
Normal file → Executable file
|
@ -868,9 +868,7 @@ bail3:
|
|||
close_reason = LWS_CLOSE_STATUS_NOSTATUS;
|
||||
|
||||
bail2:
|
||||
if (wsi->protocol &&
|
||||
(wsi->state == LWSS_ESTABLISHED ||
|
||||
wsi->state == LWSS_CLIENT_UNCONNECTED)) {
|
||||
if (wsi->protocol && wsi->state == LWSS_ESTABLISHED) {
|
||||
if (isErrorCodeReceived && p) {
|
||||
wsi->protocol->callback(wsi,
|
||||
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
|
||||
|
|
12
lib/libwebsockets.c
Normal file → Executable file
12
lib/libwebsockets.c
Normal file → Executable file
|
@ -405,10 +405,20 @@ just_kill_connection:
|
|||
wsi->user_space, NULL, 0 );
|
||||
} else if (wsi->mode == LWSCM_WSCL_WAITING_SERVER_REPLY ||
|
||||
wsi->mode == LWSCM_WSCL_WAITING_CONNECT) {
|
||||
char* errorString;
|
||||
|
||||
lwsl_debug("Connection closed before server reply\n");
|
||||
context->protocols[0].callback(wsi,
|
||||
errorString = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP);
|
||||
if (errorString) {
|
||||
context->protocols[0].callback(wsi,
|
||||
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
|
||||
wsi->user_space, errorString,
|
||||
(unsigned int)strlen(errorString));
|
||||
} else {
|
||||
context->protocols[0].callback(wsi,
|
||||
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
|
||||
wsi->user_space, NULL, 0);
|
||||
}
|
||||
} else
|
||||
lwsl_debug("not calling back closed mode=%d state=%d\n",
|
||||
wsi->mode, wsi->state_pre_close);
|
||||
|
|
Loading…
Add table
Reference in a new issue