[Libwebsockets] List custom http headers and POST fields and/or exposing the private headers
deionut at yahoo.com
Fri Feb 26 15:57:15 CET 2021
I am new to LWS. I am trying to implement a C++ wrapper around LWS for exposing a simplified http/https server set of classes ( e.g. CppHttpServer, CppHttpRequest, CppHttpResponse ) to higher application code.I am planning to collect all the data of the http request (standard http request headers (as enumerated in enum lws_token_indexes), custom http request headers, GET query parameters and POST form data fields) and populate the custom CppHttpRequest class with this data before passing it to the higher application code. My problem with this approach is that I can not list all the custom http headers and the post data fields. The LWS C API requires that the caller knows before-hand the names of the custom headers and post data fields he is interested in. Is there a way to list all these names with the public LWS C API or are the LWS maintainers planning to implement such an API?
Looking at how the pubic functions lws_hdr_custom_length() / lws_hdr_custom_copy() are implemented I managed to retrieve all the http request custom headers. I plan to do the same thing for the POST form data fields by looking at the implementation in lws_spa_get_string() / lws_spa_get_length() (although the implementation here is much more complicated). My problem with this approach is that I need to include the private header private-lib-core.h which is not exposed by the standard cmake build. So my second question is how to build LWS to export the private headers?
Thanks & regards,Ionut Dediu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libwebsockets