From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from www.andreasvoegele.com (www.andreasvoegele.com [176.9.54.163]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id 32b62645 for ; Tue, 28 Feb 2017 03:05:10 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=andreasvoegele.com; s=july2016; h=Content-Type:MIME-Version:Date:Message-ID :To:Subject:From:Cc:Reply-To:References:In-Reply-To:Content-Transfer-Encoding ; bh=5kIFJG6m7LLHudMvn9eUmQ23GODMylCsAwptnbD5/Pk=; b=whgD45fH4PjDhF8/wiNkP7si rtWEbWWZOZG+AiXFMkOsPYS7+DYUUXVkUcD49HXI7BWjmMTJAXTa5Yr1mdsnLTzs+Y7qEdYNbavrH aF3V+sQ1W6Idbaedfbm94K84RkhkJZF7FILdDBJda1MtXRmGAWmM2wXZj5WhJO7GvZ8HgQ=; Received: from p2003006a69499b011c261aa3d834ab87.dip0.t-ipconnect.de ([2003:6a:6949:9b01:1c26:1aa3:d834:ab87]) by www.andreasvoegele.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89_RC6) (envelope-from ) id 1cicmT-00041C-Lz for tech@mdocml.bsd.lv; Tue, 28 Feb 2017 09:05:09 +0100 From: =?UTF-8?Q?Andreas_V=c3=b6gele?= Subject: check environment variable HTTPS in cgi.c To: tech@mdocml.bsd.lv Message-ID: Date: Tue, 28 Feb 2017 09:05:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------61A53C6A8B6BF13EAB62ABC7" This is a multi-part message in MIME format. --------------61A53C6A8B6BF13EAB62ABC7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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 --------------61A53C6A8B6BF13EAB62ABC7 Content-Type: text/x-patch; name="cgi_c_https.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cgi_c_https.diff" --- 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" --------------61A53C6A8B6BF13EAB62ABC7-- -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv