aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/cgi
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2022-12-03 00:09:22 +0000
committerGopher Robot <gobot@golang.org>2023-10-04 16:50:58 +0000
commit3a69dcdc9f487f79fdce82536c97b49ba7f216c7 (patch)
treefdaa2e96b28e0565260d6bc4fedd35b7e4a4bc17 /src/net/http/cgi
parent68a12a80235fae67dc64fa2d232186a2e85c05f5 (diff)
downloadgo-3a69dcdc9f487f79fdce82536c97b49ba7f216c7.tar.xz
net/http/cgi: set SERVER_PORT to 443 when req.TLS != nil
A hostname without a port leaves the port implied by the protocol. For HTTPS, the implied port is 443, not 80. Change-Id: I873a076068f84c8041abf10a435d9499635730a0 Reviewed-on: https://go-review.googlesource.com/c/go/+/454975 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/net/http/cgi')
-rw-r--r--src/net/http/cgi/host.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/net/http/cgi/host.go b/src/net/http/cgi/host.go
index 073952a7bd..085658ee7a 100644
--- a/src/net/http/cgi/host.go
+++ b/src/net/http/cgi/host.go
@@ -132,6 +132,9 @@ func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
}
port := "80"
+ if req.TLS != nil {
+ port = "443"
+ }
if matches := trailingPort.FindStringSubmatch(req.Host); len(matches) != 0 {
port = matches[1]
}