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: QUERY_STRING not used when REQUEST_URI is set (Tomcat) #54961

Open
TamyGit opened this issue Sep 9, 2022 · 1 comment
Open
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@TamyGit
Copy link

TamyGit commented Sep 9, 2022

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

$ go version
go version go1.19.1 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

Compile on Debian GNU/Linux 11 (bullseye) with Intel CPU
Run on Raspbian GNU/Linux 10 (buster) with Armv7 (Raspberry Pi 3 Model B)

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.1"
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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3827448816=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I created a CGI program which parse GET Parameters with net/http#Request.ParseForm.
On Apache, that works.
On Tomcat, it doesn't.
The reason is a environment variable "REQUEST_URI" doesn't include parameters on Tomcat, I guess.

Environment variables:

[Apache]
REQUEST_URI="/cgi-bin/testcgi?id=1"
QUERY_STRING="id=1"

[Tomcat]
REQUEST_URI="/cgi-bin/testcgi"
QUERY_STRING="id=1"

I checked the source code of this problem. (net/http/cgi/child.go)
QUERY_STRING is used only when REQUEST_URI is blank. (Am I right?)

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 9, 2022
@mknyszek mknyszek added this to the Backlog milestone Sep 9, 2022
@mknyszek
Copy link
Contributor

mknyszek commented Sep 9, 2022

CC @neild

@seankhliao seankhliao changed the title net/http/cgi: 'GET Parameters' are not available on Tomcat net/http/cgi: QUERY_STRING not used when REQUEST_URI is set (Tomcat) Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants