diff options
author | schmirl <schmirl> | 2008-10-14 11:05:46 +0000 |
---|---|---|
committer | schmirl <schmirl> | 2008-10-14 11:05:46 +0000 |
commit | 86c82c138122a9ed282a6496c8e20ceceda3ef16 (patch) | |
tree | ab406c1d655af306a5e8460fe5f31af28775b713 /streamdev-server.c | |
parent | 992444cb67e700619293d3642f95f40b18d1b62e (diff) | |
download | vdr-plugin-streamdev-86c82c138122a9ed282a6496c8e20ceceda3ef16.tar.gz vdr-plugin-streamdev-86c82c138122a9ed282a6496c8e20ceceda3ef16.tar.bz2 |
- added HTTP authentication (#475)
Modified Files:
HISTORY README streamdev-server.c server/connection.h
server/connectionHTTP.c server/connectionHTTP.h
server/server.c server/server.h
Diffstat (limited to 'streamdev-server.c')
-rw-r--r-- | streamdev-server.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/streamdev-server.c b/streamdev-server.c index 9892cb2..6b4ff6f 100644 --- a/streamdev-server.c +++ b/streamdev-server.c @@ -3,10 +3,11 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: streamdev-server.c,v 1.10 2008/10/13 11:30:05 schmirl Exp $ + * $Id: streamdev-server.c,v 1.11 2008/10/14 11:05:47 schmirl Exp $ */ #include <getopt.h> +#include <vdr/tools.h> #include "remux/extern.h" #include "streamdev-server.h" #include "server/setup.h" @@ -25,6 +26,7 @@ cPluginStreamdevServer::cPluginStreamdevServer(void) cPluginStreamdevServer::~cPluginStreamdevServer() { + free(opt_auth); free(opt_remux); } @@ -36,20 +38,35 @@ const char *cPluginStreamdevServer::Description(void) const char *cPluginStreamdevServer::CommandLineHelp(void) { // return a string that describes all known command line options. - return " -r <CMD>, --remux=<CMD> Define an external command for remuxing.\n"; + return + " -a <LOGIN:PASSWORD>, --auth=<LOGIN:PASSWORD> Credentials for HTTP authentication.\n" + " -r <CMD>, --remux=<CMD> Define an external command for remuxing.\n" + ; } bool cPluginStreamdevServer::ProcessArgs(int argc, char *argv[]) { // implement command line argument processing here if applicable. static const struct option long_options[] = { + { "auth", required_argument, NULL, 'a' }, { "remux", required_argument, NULL, 'r' }, { NULL, 0, NULL, 0 } }; int c; - while((c = getopt_long(argc, argv, "r:", long_options, NULL)) != -1) { + while((c = getopt_long(argc, argv, "a:r:", long_options, NULL)) != -1) { switch (c) { + case 'a': + { + if (opt_auth) + free(opt_auth); + int l = strlen(optarg); + cBase64Encoder Base64((uchar*) optarg, l, l * 4 / 3 + 3); + const char *s = Base64.NextLine(); + if (s) + opt_auth = strdup(s); + } + break; case 'r': if (opt_remux) free(opt_remux); |