[Libwebsockets] How to get query parameters in overridden file open

Andy Green andy at warmcat.com
Fri Dec 1 00:23:28 CET 2017



On 11/30/2017 07:10 PM, polan at os.pl wrote:
> 
> Hello,
> 
> what would be proper way to handle such scenario - request for file from 
> virtual path with some parameters specified in query string, e.g.:
> http://foo.com/myfile.ext?param1=234&param2=987
> 
> In "struct lws_plat_file_ops"
> we have
> lws_fop_fd_t (*LWS_FOP_OPEN)(const struct lws_plat_file_ops *fops,
> const char *filename, const char *vpath,
> lws_fop_flags_t *flags);
> but lws_get_urlarg_by_name() requires current "lws*wsi".
> 
> In other words how to properly access "wsi" from file open callback in 
> http server?

There's no requirement that the vfs operation is bound to a wsi, so 
there's no wsi associated with it.

Can you explain a bit more about what the parameters want to do?  It's 
choose a piece of the file to serve, or something else?  Presumably you 
want to use generic mounts and then just put the special code in the vfs 
part?

-Andy

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


More information about the Libwebsockets mailing list