Skip to content

net/http: response.ContentLength is only considering header key "Content-Length" case sensitive #65604

Closed
@akrieg-ionos

Description

@akrieg-ionos

Go version

go version go1.22.0 linux/amd64

Output of go env in your module/workspace:

go env
GO111MODULE='on'                                                                                                                                                                                                                                 ─╯
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/akrieg/.cache/go-build'
GOENV='/home/akrieg/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/akrieg/go/pkg/mod'
GONOPROXY='github.com/ionos-cloud'
GONOSUMDB='github.com/ionos-cloud'
GOOS='linux'
GOPATH='/home/akrieg/go'
GOPRIVATE='github.com/ionos-cloud'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/akrieg/projects/paas/paaskit/go-paaskit/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3927774349=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I want to use response.ContentLength attribute.

What did you see happen?

If the response header has e.g. the key content-length response.ContentLength is not set as only "Content-Length" is taken into account.

What did you expect to see?

However afaik header keys are case insensitive. So, if a response contains Content-Length or e.g. content-length as header should make no difference regarding the response.ContentLength attribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions