[Libwebsockets] libwebsocket problem

Andy Green andy at warmcat.com
Thu May 16 06:34:52 CEST 2019

On 5/16/19 4:34 AM, Wei, Catherine wrote:

> Hi, I’m using libwebsocket 3.0.1 in my code. I can only get the url 
> without query parameters. Is there any interface or any way to get the 
> complete url of the client connection?

Query parameters get parsed out of the url string so they and the path 
part are available separately... you can get hold of them using:

  * lws_get_urlarg_by_name() - return pointer to arg value if present
  * \param wsi: the connection to check
  * \param name: the arg name, like "token="
  * \param buf: the buffer to receive the urlarg (including the name= part)
  * \param len: the length of the buffer to receive the urlarg
  *     Returns NULL if not found or a pointer inside buf to just after the
  *     name= part.
lws_get_urlarg_by_name(struct lws *wsi, const char *name, char *buf, int 


Notice the query string includes the '='.


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

More information about the Libwebsockets mailing list