Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http/cgi: the SERVER_NAME variable in the CGI environment should not contain the port #53368

Closed
zapateo opened this issue Jun 14, 2022 · 2 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@zapateo
Copy link

zapateo commented Jun 14, 2022

What version of Go are you using (go version)?

$ go version
go version go1.18.3 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/zapateo/.cache/go-build"
GOENV="/home/zapateo/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/zapateo/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/zapateo/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/zapateo/Programmi/go1.18.3.linux-amd64/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/zapateo/Programmi/go1.18.3.linux-amd64/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build4099781282=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Executing a CGI in a subprocess using the net/http/cgi.Handler, passing a *http.Request that contains a port in its Host.

What did you expect to see?

The SERVER_NAME variable in the CGI environment should not contain the port, according to the section 4.1.14 of the RFC 3875.

Such spec should be implemented by the net/http/cgi package, as stated in:

// Package cgi implements CGI (Common Gateway Interface) as specified
// in RFC 3875.

What did you see instead?

The SERVER_NAME env variable, initialized here:

"SERVER_NAME=" + req.Host,

is initialized with req.Host, which may contain the port.

@seankhliao seankhliao added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 15, 2022
@seankhliao
Copy link
Member

a similar issue for REMOTE_HOST/PORT was #9861

cc @neild @bradfitz

@gopherbot
Copy link

Change https://go.dev/cl/412434 mentions this issue: net/http/cgi: remove port from the CGI environment of variable SERVER_NAME

@dmitshur dmitshur added this to the Go1.20 milestone Aug 10, 2022
@golang golang locked and limited conversation to collaborators Aug 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants