From 651544312cd78c3008bbc596cc9fc47c284cd89e Mon Sep 17 00:00:00 2001 From: David Galeano Date: Thu, 10 Jan 2013 10:37:29 +0800 Subject: [PATCH] Close connection if LWS_CALLBACK_HTTP returns non-zero. --- lib/handshake.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/handshake.c b/lib/handshake.c index a844b055..237adf79 100644 --- a/lib/handshake.c +++ b/lib/handshake.c @@ -586,10 +586,11 @@ libwebsocket_read(struct libwebsocket_context *context, !wsi->utf8_token[WSI_TOKEN_CONNECTION].token_len) { wsi->state = WSI_STATE_HTTP; if (wsi->protocol->callback) - (wsi->protocol->callback)(context, wsi, - LWS_CALLBACK_HTTP, wsi->user_space, - wsi->utf8_token[WSI_TOKEN_GET_URI].token, - wsi->utf8_token[WSI_TOKEN_GET_URI].token_len); + if (wsi->protocol->callback(context, wsi, + LWS_CALLBACK_HTTP, wsi->user_space, + wsi->utf8_token[WSI_TOKEN_GET_URI].token, + wsi->utf8_token[WSI_TOKEN_GET_URI].token_len)) + goto bail; return 0; }