[Libwebsockets] POST client

Karl Vogel karl.vogel at gmail.com
Fri Mar 6 13:29:57 CET 2020


I'm trying to issue a POST with a msgpack payload to fluent. However I'm
always getting back an error in the LWS_CALLBACK_CLIENT_CONNECTION_ERROR
callback with error message "HS: URI missing", while the post is correctly
being received by fluent and it's replying with an HTTP-200.

The LWS_CALLBACK_CLIENT_HTTP_WRITEABLE just does an lws_write of the
msgpack payload, with LWS_WRITE_HTTP_FINAL set. I am setting the
Content-Type and Content-Length headers in the handshake callback.

The callback sequence is:
>>>>>>>>>>>>>> LWS_CALLBACK_PROTOCOL_INIT
>>>>>>>>>>>>>> LWS_CALLBACK_CLIENT_HTTP_BIND_PROTOCOL
>>>>>>>>>>>>>> LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED
>>>>>>>>>>>>>> LWS_CALLBACK_WSI_CREATE
>>>>>>>>>>>>>> LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER
setting headers
>>>>>>>>>>>>>> LWS_CALLBACK_CLIENT_HTTP_WRITEABLE
 writing payload 55 bytes
>>>>>>>>>>>>>> LWS_CALLBACK_CLIENT_CONNECTION_ERROR
LWS_CALLBACK_CLIENT_CONNECTION_ERROR: HS: URI missing
>>>>>>>>>>>>>> LWS_CALLBACK_CLIENT_HTTP_DROP_PROTOCOL
>>>>>>>>>>>>>> LWS_CALLBACK_CLOSED_CLIENT_HTTP
 ** FAILED (-1) **

I had a look at the minimal post example, but that one is using multipart
body parts, while my code is just posting the raw msgpack message. Is this
supported? How should the writeable callback end the post?

Using the master branch.

Karl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20200306/f745e029/attachment.htm>


More information about the Libwebsockets mailing list