From 52b4bfcd8cf144f3fdd7f3b22f3c9ae2e58b7df9 Mon Sep 17 00:00:00 2001 From: schmirl Date: Tue, 14 Oct 2008 11:05:57 +0000 Subject: - added HTTP authentication (#475) Modified Files: Tag: v0_4 HISTORY README streamdev-server.c server/connection.h server/connectionHTTP.c server/connectionHTTP.h server/server.c server/server.h --- streamdev-server.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'streamdev-server.c') diff --git a/streamdev-server.c b/streamdev-server.c index f2c933a..b7e136c 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.7.2.1 2008/04/29 07:00:57 schmirl Exp $ + * $Id: streamdev-server.c,v 1.7.2.2 2008/10/14 11:05:57 schmirl Exp $ */ #include +#include #include "streamdev-server.h" #include "server/setup.h" #include "server/server.h" @@ -26,6 +27,7 @@ cPluginStreamdevServer::cPluginStreamdevServer(void) cPluginStreamdevServer::~cPluginStreamdevServer() { + free(opt_auth); free(opt_remux); } @@ -37,20 +39,35 @@ const char *cPluginStreamdevServer::Description(void) const char *cPluginStreamdevServer::CommandLineHelp(void) { // return a string that describes all known command line options. - return " -r , --remux= Define an external command for remuxing.\n"; + return + " -a , --auth= Credentials for HTTP authentication.\n" + " -r , --remux= 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); -- cgit v1.2.3