From a38b565e472c7315c8cc585564b44135243c9b89 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sat, 5 Jul 2014 12:53:57 +0200 Subject: [PATCH] add cmdline args to pass SSL key/cert files --- TODO | 1 - jackwsmeter.c | 22 ++++++++-------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/TODO b/TODO index 29c940f..25248d6 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ -- cmdline arg to point to SSL files - documentation - README (including protocol description) - manpage diff --git a/jackwsmeter.c b/jackwsmeter.c index 71219b5..4f6707a 100644 --- a/jackwsmeter.c +++ b/jackwsmeter.c @@ -206,7 +206,8 @@ static struct option options[] = { { "help", no_argument, NULL, 'h' }, { "debug", required_argument, NULL, 'd' }, { "port", required_argument, NULL, 'p' }, - { "ssl", no_argument, NULL, 's' }, + { "ssl-cert", required_argument, NULL, 'E' }, + { "ssl-key", required_argument, NULL, 'k' }, { "interface", required_argument, NULL, 'i' }, { "closetest", no_argument, NULL, 'c' }, #ifndef LWS_NO_DAEMONIZE @@ -271,7 +272,6 @@ static void cleanup() int main(int argc, char **argv) { int n = 0; - int use_ssl = 0; struct libwebsocket_context *context; int opts = 0; char interface_name[128] = ""; @@ -305,8 +305,11 @@ int main(int argc, char **argv) case 'd': debug_level = atoi(optarg); break; - case 's': - use_ssl = 1; + case 'E': + info.ssl_cert_filepath = strdup(optarg); + break; + case 'k': + info.ssl_private_key_filepath = strdup(optarg); break; case 'p': info.port = atoi(optarg); @@ -322,7 +325,7 @@ int main(int argc, char **argv) break; case 'h': fprintf(stderr, "Usage: jackwsserver " - "[--port=

] [--ssl] " + "[--port=

] [--ssl-cert FILEPATH] [--ssl-key FILEPATH] " "[-d ] +\n"); exit(1); } @@ -362,15 +365,6 @@ int main(int argc, char **argv) #ifndef LWS_NO_EXTENSIONS info.extensions = libwebsocket_get_internal_extensions(); #endif - if (!use_ssl) { - info.ssl_cert_filepath = NULL; - info.ssl_private_key_filepath = NULL; - } else { - /* - info.ssl_cert_filepath = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem"; - info.ssl_private_key_filepath = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem"; - */ - } info.gid = -1; info.uid = -1; info.options = opts; -- 2.11.4.GIT