diff options
Diffstat (limited to 'usr.sbin/httpd/server_http.c')
-rw-r--r-- | usr.sbin/httpd/server_http.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/httpd/server_http.c b/usr.sbin/httpd/server_http.c index 4a46f6b44ba..d01c1eab93f 100644 --- a/usr.sbin/httpd/server_http.c +++ b/usr.sbin/httpd/server_http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_http.c,v 1.136 2020/01/14 20:48:57 benno Exp $ */ +/* $OpenBSD: server_http.c,v 1.137 2020/02/25 15:18:41 sthen Exp $ */ /* * Copyright (c) 2006 - 2018 Reyk Floeter <reyk@openbsd.org> @@ -1148,6 +1148,15 @@ server_expand_http(struct client *clt, const char *val, char *buf, if (ret != 0) return (NULL); } + if (strstr(val, "$REQUEST_SCHEME") != NULL) { + if (srv_conf->flags & SRVFLAG_TLS) { + ret = expand_string(buf, len, "$REQUEST_SCHEME", "https"); + } else { + ret = expand_string(buf, len, "$REQUEST_SCHEME", "http"); + } + if (ret != 0) + return (NULL); + } if (strstr(val, "$SERVER_") != NULL) { if (strstr(val, "$SERVER_ADDR") != NULL) { if (print_host(&srv_conf->ss, |