[Libwebsockets] How to get HTTP request content

Andy Green andy at warmcat.com
Fri May 20 14:56:33 CEST 2016



On May 20, 2016 8:47:45 PM GMT+08:00, Roger Schreiter <roger at planinternet.de> wrote:
>Hello,
>
>I have a web page, which sends data to the web server
>via the POST method. The web server is running libwebscokets.
>
>With libwebsockets, I could successfully read request header lines
>like
>Content-type
>or
>Content-length.
>
>But I could not find the content itself, i.e. the request
>body.
>
>Is there any mean to get the request body containing
>the the query paramaters, when using POST?

Yes, lws has some callbacks dedicated to it.

On master you can see how to do it in a plugin

https://github.com/warmcat/libwebsockets/blob/master/plugins/protocol_post_demo.c

But the related callbacks are not new, it works the same way on older lws.

-Andy

>
>Regards,
>Roger.
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list