From 5e7cd6133d2ca029b7671aadd0347e87fb906673 Mon Sep 17 00:00:00 2001 From: reyk Date: Mon, 4 Aug 2014 18:00:06 +0000 Subject: [PATCH] Add HTTPS = on CGI variable. --- usr.sbin/httpd/config.c | 5 ++++- usr.sbin/httpd/server_fcgi.c | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/usr.sbin/httpd/config.c b/usr.sbin/httpd/config.c index 35405b8499b..02f2f7133c2 100644 --- a/usr.sbin/httpd/config.c +++ b/usr.sbin/httpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.15 2014/08/04 17:38:12 reyk Exp $ */ +/* $OpenBSD: config.c,v 1.16 2014/08/04 18:00:06 reyk Exp $ */ /* * Copyright (c) 2011 - 2014 Reyk Floeter @@ -266,6 +266,9 @@ config_getserver_config(struct httpd *env, struct server *srv, if ((srv_conf->flags & f) == 0) srv_conf->flags |= srv->srv_conf.flags & f; + f = SRVFLAG_SSL; + srv_conf->flags |= srv->srv_conf.flags & f; + DPRINTF("%s: %s %d location \"%s\", " "parent \"%s\", flags: %s", __func__, ps->ps_title[privsep_process], ps->ps_instance, diff --git a/usr.sbin/httpd/server_fcgi.c b/usr.sbin/httpd/server_fcgi.c index a5ba108a67e..1432646b352 100644 --- a/usr.sbin/httpd/server_fcgi.c +++ b/usr.sbin/httpd/server_fcgi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_fcgi.c,v 1.20 2014/08/04 14:49:24 reyk Exp $ */ +/* $OpenBSD: server_fcgi.c,v 1.21 2014/08/04 18:00:06 reyk Exp $ */ /* * Copyright (c) 2014 Florian Obser @@ -244,6 +244,12 @@ server_fcgi(struct httpd *env, struct client *clt) goto fail; } + if (srv_conf->flags & SRVFLAG_SSL) + if (fcgi_add_param(¶m, "HTTPS", "on", clt) == -1) { + errstr = "failed to encode param"; + goto fail; + } + (void)print_host(&clt->clt_ss, hbuf, sizeof(hbuf)); if (fcgi_add_param(¶m, "REMOTE_ADDR", hbuf, clt) == -1) { errstr = "failed to encode param"; -- 2.20.1