[Libwebsockets] libwebsocket problem

Wei, Catherine catherine.wei at commscope.com
Thu May 16 07:19:25 CEST 2019

Thanks for your reply. However, I don't know the parameters, so using the lws_get_urlarg_by_name is not useful for me. Do you know how can I add a patch to it so that I can in any way get the complete url. Which file to patch? Very appreciate for your help.

Best regards,

-----Original Message-----
From: Andy Green <andy at warmcat.com> 
Sent: 2019年5月16日 12:35
To: Wei, Catherine <catherine.wei at commscope.com>; libwebsockets at ml.libwebsockets.org
Subject: Re: [Libwebsockets] libwebsocket problem

Email Security Warning:

The following message was sent from an external e-mail address. Exercise caution when opening attachments, clicking links, or exchanging information.

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 len);


Notice the query string includes the '='.


> Thanks.
> Best regards,
> Catherine
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://secure-web.cisco.com/1PIY-al4ld2y8PkT2pFAoxGddOzFzURz907jhnINd
> 2v_iNqBVsW9rIcFipJBOzVMvTcCcCSCp1fAWzZ94jKILXOBf-YnDIM8fIbhWJzLa2yv3u1
> j5qgNRezrk0FR3UWStcMPCYo7G7vUYSzIxcJvNJJHshk5wMME-FsPDDByR5JKfD3Tbw4y6
> Zc-anf92SLViSMIorC3dlahweUkQx_N8WtJHs580fzfJlDrLkI3mSLMyNZhy60vFzF08Tf
> /https%3A%2F%2Flibwebsockets.org%2Fmailman%2Flistinfo%2Flibwebsockets

More information about the Libwebsockets mailing list