[Libwebsockets] vhost origin in user plugin?

Joel Winarske joel.winarske at gmail.com
Tue Mar 28 05:01:38 CEST 2017


Hi,

I need the uri root path "origin" as set in the lsws config file for a
given vhost.  Say I set "origin" to file:///home/joel /www

In the plugin I need to access this value.

Thanks,
Joel

On Mon, Mar 27, 2017 at 6:50 PM Andy Green <andy at warmcat.com> wrote:

>
>
> On 03/28/2017 08:39 AM, Joel Winarske wrote:
> >
> > Is there a way to get the vhost "origin" path in a user plugin?
>
> A vhost may have several ways to get to it that could be the origin...
> eg xyz.com, www.xyz.com, etc.
>
> The individual connection chose one and for whatever reason (if nothing
> else to go on like SNI, or Host:, "first" vhost ends up being the
> default) it hooked up to that logical vhost.
>
> So to get the origin that the client also thinks is "your origin", that
> he used to get to you, you have to grab this from the incoming
> connection while the ah is still attached, eg, LWS_CALLBACK_HTTP or so,
> by copying out the hdr WSI_TOKEN_ORIGIN.
>
> If it's that you have only made an outgoing connection and want to send
> a hint of what that peer should use as the origin to connect back to
> your vhost, vhost.name is used as the match for SNI Common Name.  But
> there's no way atm to get it.
>
> If you need it, add an accessor like const char *
> lws_get_vhost_name(const lws_vhost *vhost) and I can add it.
>
> -Andy
>
> >
> >
> >
> > _______________________________________________
> > Libwebsockets mailing list
> > Libwebsockets at ml.libwebsockets.org
> > https://libwebsockets.org/mailman/listinfo/libwebsockets
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20170328/c17876c2/attachment-0002.html>


More information about the Libwebsockets mailing list