diff options
author | Jonathan Bauer | 2019-05-14 10:15:48 +0200 |
---|---|---|
committer | Jonathan Bauer | 2019-05-14 10:15:48 +0200 |
commit | 7e4e3a2f43704700f905b9bcbdf98278e23508fa (patch) | |
tree | 76b955bc60db742a1eae822d6618719ef03f5825 /src | |
parent | No need to QTextBrowser, use QTextEdit (diff) | |
download | vmchooser2-7e4e3a2f43704700f905b9bcbdf98278e23508fa.tar.gz vmchooser2-7e4e3a2f43704700f905b9bcbdf98278e23508fa.tar.xz vmchooser2-7e4e3a2f43704700f905b9bcbdf98278e23508fa.zip |
introduce '--insecure' option ...
to disable ssl certificate verification
Diffstat (limited to 'src')
-rw-r--r-- | src/command_line_options.cpp | 6 | ||||
-rw-r--r-- | src/main.cpp | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/command_line_options.cpp b/src/command_line_options.cpp index 466292a..fc4e0e1 100644 --- a/src/command_line_options.cpp +++ b/src/command_line_options.cpp @@ -17,6 +17,7 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) { {"fullscreen", no_argument, nullptr, 'F'}, {"file", required_argument, nullptr, 'f'}, {"help", no_argument, nullptr, 'h'}, + {"insecure", no_argument, nullptr, 'i'}, {"locations", required_argument, nullptr, 'l'}, {"pool", required_argument, nullptr, 'P'}, {"pvs", no_argument, nullptr, 'p'}, @@ -41,7 +42,7 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) { int c; // Again, please sort alphabetically in getopt_long call and switch statement - while ((c = getopt_long(argc, argv, "b:c:Dd:Ff:hl:P:pSs:t:T:u:vx:?", longOptions, nullptr)) != -1) { + while ((c = getopt_long(argc, argv, "b:c:Dd:Ff:hil:P:pSs:t:T:u:vx:?", longOptions, nullptr)) != -1) { switch (c) { case 'aqit': options.insert("autoquit", optarg); @@ -71,6 +72,9 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) { case '?': options.insert("usage", "usage"); break; + case 'i': + options.insert("insecure", "nossl"); + break; case 'l': options.insert("locations", optarg); break; diff --git a/src/main.cpp b/src/main.cpp index 86311e5..1da6f68 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,7 +21,6 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); - QTranslator translator; translator.load(":" + QLocale::system().name()); a.installTranslator(&translator); @@ -100,6 +99,11 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } } + if (cmdOptions.contains("insecure")) { + QSslConfiguration sslConf = QSslConfiguration::defaultConfiguration(); + sslConf.setPeerVerifyMode(QSslSocket::VerifyNone); + QSslConfiguration::setDefaultConfiguration(sslConf); + } // read configuration file: // file supplied as command line option or @@ -152,6 +156,7 @@ int main(int argc, char *argv[]) { g_runVmScript = settings.value("runscript").toString(); } + if (cmdOptions.contains("url")) { g_urlBase = cmdOptions.value("url"); } else if (settings.contains("url")) { |