Skip to content

net/http: Host Header must not be deleted from http.Request.Header #66454

Closed as not planned
@torikki-tou

Description

@torikki-tou

Go version

go version go1.22.0 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/torikki/Library/Caches/go-build'
GOENV='/Users/torikki/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/torikki/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/torikki/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/torikki/sdk/go1.22.0'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/torikki/sdk/go1.22.0/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/torikki/GolandProjects/connection-watcher/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/xz/tlwsgxjj4tl8s8v729j6w74w0000gn/T/go-build1614244256=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

I wanted to get Host header directly from http.Request.Header but eventually found out that it is accessible only from http.Request.Host. Why is that? Would be nice to have strait access

What did you see happen?

Host header accessible only from http.Request.Host where it might be mixed with data from URL or HTTP/2 :authority header. I need Host header unchanged

What did you expect to see?

Get Host header accessible from http.Request.Header

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions