[Libwebsockets] vhost origin in user plugin?

Andy Green andy at warmcat.com
Tue Mar 28 05:04:35 CEST 2017



On 03/28/2017 11:01 AM, Joel Winarske wrote:
> 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.

That's something completely different... "origin" has its own meaning 
for http

https://en.wikipedia.org/wiki/Cross-origin_resource_sharing

You're talking about mounts then... the plugin doesn't know that 
information... it sounds like it shouldn't know it either... what are 
you trying to do?  You might need the vfs / fops stuff.

-Andy

>
> Thanks,
> Joel
>
> On Mon, Mar 27, 2017 at 6:50 PM Andy Green <andy at warmcat.com 
> <mailto: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 <http://xyz.com>, www.xyz.com <http://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 <http://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
>     <mailto:Libwebsockets at ml.libwebsockets.org>
>     > https://libwebsockets.org/mailman/listinfo/libwebsockets
>




More information about the Libwebsockets mailing list