From 9f40e8f91ec6475308c265ea37b25033f616ce48 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 30 May 2015 18:25:39 +0200 Subject: add support for enforcing HTTPS Signed-off-by: Jo-Philipp Wich --- main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index fba5f80..ed47486 100644 --- a/main.c +++ b/main.c @@ -134,6 +134,7 @@ static int usage(const char *name) " -s [addr:]port Like -p but provide HTTPS on this port\n" " -C file ASN.1 server certificate file\n" " -K file ASN.1 server private key file\n" + " -q Redirect all HTTP requests to HTTPS\n" #endif " -h directory Specify the document root, default is '.'\n" " -E string Use given virtual URL as 404 error handler\n" @@ -227,7 +228,7 @@ int main(int argc, char **argv) init_defaults_pre(); signal(SIGPIPE, SIG_IGN); - while ((ch = getopt(argc, argv, "afSDRXC:K:E:I:p:s:h:c:l:L:d:r:m:n:N:x:i:t:k:T:A:u:U:")) != -1) { + while ((ch = getopt(argc, argv, "afqSDRXC:K:E:I:p:s:h:c:l:L:d:r:m:n:N:x:i:t:k:T:A:u:U:")) != -1) { switch(ch) { #ifdef HAVE_TLS case 'C': @@ -238,12 +239,17 @@ int main(int argc, char **argv) tls_key = optarg; break; + case 'q': + conf.tls_redirect = 1; + break; + case 's': n_tls++; /* fall through */ #else case 'C': case 'K': + case 'q': case 's': fprintf(stderr, "uhttpd: TLS support not compiled, " "ignoring -%c\n", ch); -- cgit v1.2.3