tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* check environment variable HTTPS in cgi.c
@ 2017-02-28  8:05 Andreas Vögele
  2017-03-18 15:17 ` Ingo Schwarze
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Vögele @ 2017-02-28  8:05 UTC (permalink / raw)
  To: tech

[-- Attachment #1: Type: text/plain, Size: 227 bytes --]

Hi,

currently the scheme is hard-coded to "http" in cgi.c. The scheme could 
be set to "https" if the environment variable "HTTPS" is set to "on" by 
the web server. See the FastCGI setting in httpd.conf(5).

Regards,
Andreas

[-- Attachment #2: cgi_c_https.diff --]
[-- Type: text/x-patch, Size: 654 bytes --]

--- mdocml-1.14.1/cgi.c.orig	2017-02-21 01:25:20.000000000 +0100
+++ mdocml-1.14.1/cgi.c	2017-02-25 16:28:06.751637253 +0100
@@ -562,9 +562,13 @@
 		 * If we have just one result, then jump there now
 		 * without any delay.
 		 */
+		const char *scheme = "http", *https;
+		if ((https = getenv("HTTPS")) != NULL &&
+		    strcmp(https, "on") == 0)
+			scheme = "https";
 		printf("Status: 303 See Other\r\n");
-		printf("Location: http://%s/%s%s%s/%s",
-		    HTTP_HOST, scriptname,
+		printf("Location: %s://%s/%s%s%s/%s",
+		    scheme, HTTP_HOST, scriptname,
 		    *scriptname == '\0' ? "" : "/",
 		    req->q.manpath, r[0].file);
 		printf("\r\n"

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-18 16:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-28  8:05 check environment variable HTTPS in cgi.c Andreas Vögele
2017-03-18 15:17 ` Ingo Schwarze
2017-03-18 15:48   ` Anthony J. Bentley
2017-03-18 16:53     ` Ingo Schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).