From 461f2b74cf5c797f45cbb23ec98a787a6ff4ed99 Mon Sep 17 00:00:00 2001 From: reyk Date: Mon, 4 Aug 2014 17:43:20 +0000 Subject: [PATCH] Redirect to https:// if SSL/TLS is enabled. --- usr.sbin/httpd/server_file.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/httpd/server_file.c b/usr.sbin/httpd/server_file.c index b93b9292f7e..4989f195663 100644 --- a/usr.sbin/httpd/server_file.c +++ b/usr.sbin/httpd/server_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_file.c,v 1.28 2014/08/04 11:09:25 reyk Exp $ */ +/* $OpenBSD: server_file.c,v 1.29 2014/08/04 17:43:20 reyk Exp $ */ /* * Copyright (c) 2006 - 2014 Reyk Floeter @@ -89,7 +89,8 @@ server_file_access(struct client *clt, char *path, size_t len, /* Redirect to path with trailing "/" */ if (path[strlen(path) - 1] != '/') { - if (asprintf(&newpath, "http://%s%s/", + if (asprintf(&newpath, "http%s://%s%s/", + srv_conf->flags & SRVFLAG_SSL ? "s" : "", desc->http_host, desc->http_path) == -1) return (500); free(desc->http_path); -- 2.20.1