From fc0a34ad8f51ef588f44e6fc586d120d71245fed Mon Sep 17 00:00:00 2001 From: "Niall T. Davidson" Date: Mon, 10 Jun 2013 22:09:16 +0100 Subject: [PATCH 1/2] Fixed erroneous byte count reported by libwebsocket_write() --- lib/output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/output.c b/lib/output.c index ef823c3e9..21d40bcd7 100644 --- a/lib/output.c +++ b/lib/output.c @@ -498,7 +498,7 @@ send_raw: if (n < 0) return n; - return orig_len - ((len - pre + post) -n ); + return orig_len - ((len + pre + post) -n ); } LWS_VISIBLE int libwebsockets_serve_http_file_fragment( From a2073a48e35796e1490b947c58228ab3aae3a126 Mon Sep 17 00:00:00 2001 From: "Niall T. Davidson" Date: Mon, 10 Jun 2013 22:22:52 +0100 Subject: [PATCH 2/2] Added additional LWS_CALLBACK_CLOSED_HTTP callback to just_kill_connection branch of close_and_free_session --- lib/libwebsockets.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index e75a51009..661876eda 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -370,6 +370,10 @@ just_kill_connection: lwsl_debug("calling back CLOSED\n"); wsi->protocol->callback(context, wsi, LWS_CALLBACK_CLOSED, wsi->user_space, NULL, 0); + } else if ( wsi->mode == LWS_CONNMODE_HTTP_SERVING_ACCEPTED ) { + lwsl_debug("calling back CLOSED_HTTP\n"); + context->protocols[0].callback(context, wsi, + LWS_CALLBACK_CLOSED_HTTP, wsi->user_space, NULL, 0 ); } else lwsl_debug("not calling back closed\n");