[Libwebsockets] Dummy http server URL modification

Jukka Marin jukka.marin at jmp.fi
Thu Mar 24 10:15:15 CET 2022


Dear List,

I'm using lws as a websocket and http server.  Now I need to implement
a "default path" for the html files if the http client isn't recognized.
For known clients, the server has separate directories, but for unknown
clients, it needs to use a common default path.

Well, I thought I would write a wrapper around lws_callback_http_dummy()
and check the URL in LWS_CALLBACK_HTTP and change it to the default
path if necessary, then calling lws_callback_http_dummy().  It seems
that LWS_CALLBACK_HTTP is not triggered for all requests (odd?) and
even if I change the URL and pass the changed URL to dummy(), the http
server still uses the original URL when accessing the filesystem.

I'm using lws '3.1.99 unknown-build-hash' at the moment.  I wonder if
what I'm trying to do works better in 4.x?

Many thanks for any advice. :-)

  -jm


More information about the Libwebsockets mailing list