Callback with reason LWS_CALLBACK_CLOSED_HTTP when HTTP closed before serve.

If the remote HTTP client closes the connection before serving commences, the
only notification client code receives is LWS_CALLBACK_WSI_DESTROY. This commit
gives LWS_CALLBACK_CLOSED_HTTP as well, as would happen if HTTP serving had
already commenced.
This commit is contained in:
Drew Noakes 2015-01-28 04:15:13 +08:00 committed by Andy Green
parent ba3c75c065
commit 6a779771f4

View file

@ -92,6 +92,10 @@ libwebsocket_close_and_free_session(struct libwebsocket_context *context,
goto just_kill_connection;
}
if (wsi->mode == LWS_CONNMODE_HTTP_SERVING)
context->protocols[0].callback(context, wsi,
LWS_CALLBACK_CLOSED_HTTP, wsi->user_space, NULL, 0);
if (wsi->mode == LWS_CONNMODE_HTTP_SERVING_ACCEPTED) {
if (wsi->u.http.fd != LWS_INVALID_FILE) {
lwsl_debug("closing http file\n");