[Libwebsockets] http response headers

Andy Green andy at warmcat.com
Tue Feb 12 17:46:29 CET 2019



On 11/02/2019 12:36, Kun Zhao wrote:
> Hi,
> 
> For http client, how do I get response headers?

At LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP you can get the server response 
code with

status = lws_http_client_http_response(wsi);

and the server's response headers with the same apis used by server-side 
to get the client request headers (they are parsed into the same ah 
struct attached to the wsi either way), eg

https://libwebsockets.org/git/libwebsockets/tree/include/libwebsockets/lws-http.h#n344-353

https://libwebsockets.org/git/libwebsockets/tree/include/libwebsockets/lws-http.h#n368-383

The list of known header indexes is here

https://libwebsockets.org/git/libwebsockets/tree/include/libwebsockets/lws-http.h#n214-305

-Andy

> Thanks,
> Kun
> 
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 


More information about the Libwebsockets mailing list