[Libwebsockets] Callbacks missing after 3.1 upgrade

Marcus Engels marcengels at att.net
Mon Jan 28 05:53:19 CET 2019


Hello,
I have some problems with clients sending post requests to the webserver based on libwebsockets after I linked the server software to the 3.1 libwebsockets library (it still works with 3.0.1). To handle POST requests the server should wait for the LWS_CALLBACK_HTTP_BODY callback, parse the request body and reply with some dynamically generated contents. 
It looks as if the LWS_CALLBACK_HTTP_WRITEABLE callback will not get started any more with the newer library. I've added calls to lws_callback_on_writeable to LWS_CALLBACK_HTTP and LWS_CALLBACK_HTTP_BODY but still don't see any calls of LWS_CALLBACK_HTTP_WRITEABLE.  I looked at the minimal-server-form-post-file example but it redirects the client to another page and only mentions that it's possible to respond with a dynamic page.  
I've modified the minimal-http-server-example.c file to print callbacks on the terminal to test the issue in a reduced environment. The POST request will be send by a small javascript file (+html loader for mount directory). When I link this example to the 3.0.1 libwebsockets library the output for callbacks started looks like the following list:

LWS_CALLBACK_HTTP                       
LWS_CALLBACK_HTTP_BODY  13
LWS_CALLBACK_HTTP_BODY_COMPLETION  14
LWS_CALLBACK_HTTP_WRITEABLE
LWS_CALLBACK_HTTP_WRITEABLE
LWS_CALLBACK_HTTP_WRITEABLE...
However when I link the same source code to the 3.1 library file I don't see LWS_CALLBACK_HTTP_WRITEABLE calls any more
LWS_CALLBACK_HTTP 
LWS_CALLBACK_HTTP_BODY  13
LWS_CALLBACK_HTTP_BODY_COMPLETION  14

and the client will only get an empty response to the request (checked target.response in debugger). 
My question is if I missed any required changes in the source code between release 3.0.1 and 3.1. I couldn't find any related info on the internet. Any help would be appreciated. 
I've attached the c source and javascript file that I used for the testing. sendpost_js needs to be renamed to sendpost.js. Looks like attachments with .js extension are not allowed. 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20190128/84a7b8da/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal-http-server-dynamic.c
Type: text/x-csrc
Size: 8712 bytes
Desc: not available
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20190128/84a7b8da/attachment.bin>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20190128/84a7b8da/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sendpost_js
Type: application/octet-stream
Size: 582 bytes
Desc: not available
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20190128/84a7b8da/attachment.obj>


More information about the Libwebsockets mailing list