DISPATCH-941: Router is returning incorrect files from http get
Bug in http-libwebsockets code. A partial HTTP handler such as we have needs to
call lws_callback_http_dummy() to fill in default HTTP behaviours. Without that
the LWS library was not properly informed of termination of HTTP transactions
causing confusion if a connection was re-used.
(cherry picked from commit c728d7f41c78ccc8db127b87c11470a5b9bc8c82)
diff --git a/src/http-libwebsockets.c b/src/http-libwebsockets.c
index 398a7ec..6df0cca 100644
--- a/src/http-libwebsockets.c
+++ b/src/http-libwebsockets.c
@@ -340,20 +340,14 @@
void *user, void *in, size_t len)
{
switch (reason) {
-
case LWS_CALLBACK_PROTOCOL_DESTROY:
qd_http_listener_free(wsi_listener(wsi));
- return -1;
-
- case LWS_CALLBACK_HTTP: {
- /* Called if file mount can't find the file */
- lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, (char*)in);
- return -1;
+ break;
+ default:
+ break;
}
-
- default:
- return 0;
- }
+ /* Do default HTTP handling for all the cases we don't care about. */
+ return lws_callback_http_dummy(wsi, reason, user, in, len);
}
/* Wake up a connection managed by the http server thread */