From: reyk Date: Mon, 4 Aug 2014 17:43:20 +0000 (+0000) Subject: Redirect to https:// if SSL/TLS is enabled. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=461f2b74cf5c797f45cbb23ec98a787a6ff4ed99;p=openbsd Redirect to https:// if SSL/TLS is enabled. --- 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);