]> git.0d.be Git - jackwsmeter.git/commitdiff
add cmdline args to pass SSL key/cert files
authorFrédéric Péters <fpeters@0d.be>
Sat, 5 Jul 2014 10:53:57 +0000 (12:53 +0200)
committerFrédéric Péters <fpeters@0d.be>
Sat, 5 Jul 2014 10:56:47 +0000 (12:56 +0200)
TODO
jackwsmeter.c

diff --git a/TODO b/TODO
index 29c940fc1a03f24ac157d6c20386017e4883fd1b..25248d682d32c93a7a983396f11d474e8ca21095 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,3 @@
-- cmdline arg to point to SSL files
 - documentation
   - README (including protocol description)
   - manpage
index 71219b598d6eb4879bf4bca9ab02e2c53e88a0c9..4f6707a34e20ac4c3a4844ac83e2bc34aee04614 100644 (file)
@@ -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=<p>] [--ssl] "
+                                       "[--port=<p>] [--ssl-cert FILEPATH] [--ssl-key FILEPATH] "
                                        "[-d <log bitfield>] <port>+\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;