Page 1 of 1

MRL/URL preprocessing with LUA scripts

Posted: 13 Nov 2011 14:25
by burek
Hi,

When VLC is started as a http streaming server (--sout='#std{access=http,...}'), it would be nice to be able to intercept all MRL/URL requests for media streams, either because of logging/statistics or because of some custom added security checks.

Let me explain on a simple example.
We start VLC as a http streaming server and let clients connect to that server and retrieve streams they want. It would be (maybe) nice to have a custom lua script executed, each time a new http request has been received. This way, admin would be able to create some nice stats/logs, based on clients' IP addresses or some http request header fields (like country/language/user-agent).

Also, if the feature implements checking of the lua script's return value, it can allow/deny further processing of that http request. For example, we could allow/deny only certain user-agents or even make some security check, based on URL params or similar.

The idea is to customize all incoming http requests, based on lua scripting, which VLC has already implemented. So, my guess is that it doesn't require too much of the coding, because it would require just a call to the lua script and catching the return value, before continuing to serve the http stream (or skip, if return value is false/null).

P.S.
A different script could be defined for each output, like --sout='#std{access=http,script=bla.lua,...}' or --sout='#std{access=http{script=bla.lua},...}'