[Libwebsockets] libwebsocket problem

Andy Green andy at warmcat.com
Thu May 16 08:01:44 CEST 2019



On May 16, 2019 6:19:25 AM GMT+01:00, "Wei, Catherine" <catherine.wei at commscope.com> wrote:
>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.

This api should be enough

https://libwebsockets.org/git/libwebsockets/tree/include/libwebsockets/lws-http.h#n388-407

-Andy

>Best regards,
>Catheriene
>
>-----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_VISIBLE LWS_EXTERN const char *
>lws_get_urlarg_by_name(struct lws *wsi, const char *name, char *buf,
>int len);
>
>https://secure-web.cisco.com/1Og4rW6xLT3Cev5v3yL71L1nPpFWaQB0DBuHWjmrq11p6hiT6_Ez8wfEntjroxhtT1HeKeLbmKOWZ36I6I3n2VSu2AJovhTv74rgjHRqt-GwNl0XkdpoX7Fd4vUV4UA8ILTNAEwNgEolIUdmfPUU98olAzBhhno6BvHweum_mVMVe87-VkKfm9lPBGWwToa6ADy7k0UVICyq7NmTNxuKIkBFR-7m-tHbu4gkxeeML4u7BhAxImSio9uOmT38-Iuq1laBq6TeUGF-izIxAJ9bW25dtmdpvItKOxRuI9LFgjHB_GDBCfvrvG_jX2co3nqGx/https%3A%2F%2Flibwebsockets.org%2Fgit%2Flibwebsockets%2Ftree%2Flib%2Flibwebsockets.h%3Fid%3Dfb31602ff9aeb88267fb8132d48df31195782ae5#n4161-4172
>
>Notice the query string includes the '='.
>
>-Andy
>
>> Thanks.
>> 
>> Best regards,
>> 
>> Catherine
>> 
>> 
>> _______________________________________________
>> Libwebsockets mailing list
>> Libwebsockets at ml.libwebsockets.org
>>
>https://secure-web.cisco.com/1PIY-al4ld2y8PkT2pFAoxGddOzFzURz907jhnINd
>>
>VN1F7lvUWHZZWVFr1umRhwNuSFKmQ7tVQSERMxgV414F-PjAwJahM_P_YDRgMOT6Q8g0WI
>>
>2v_iNqBVsW9rIcFipJBOzVMvTcCcCSCp1fAWzZ94jKILXOBf-YnDIM8fIbhWJzLa2yv3u1
>>
>j5qgNRezrk0FR3UWStcMPCYo7G7vUYSzIxcJvNJJHshk5wMME-FsPDDByR5JKfD3Tbw4y6
>>
>Zc-anf92SLViSMIorC3dlahweUkQx_N8WtJHs580fzfJlDrLkI3mSLMyNZhy60vFzF08Tf
>> /https%3A%2F%2Flibwebsockets.org%2Fmailman%2Flistinfo%2Flibwebsockets
>> 


More information about the Libwebsockets mailing list