summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-05-30 18:25:39 +0200
committerJo-Philipp Wich <jow@openwrt.org>2015-05-30 18:43:33 +0200
commit9f40e8f91ec6475308c265ea37b25033f616ce48 (patch)
tree9dcc4b8d87db637600435a7fda2beae628ce69ad /main.c
parent618493e378e2239f0d30902e47adfa134e649fdc (diff)
add support for enforcing HTTPS
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'main.c')
-rw-r--r--main.c8
1 files changed, 7 insertions, 1 deletions
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);