Skip to content

net/url: unsupported protocol scheme in header field #56027

@jnelle

Description

@jnelle

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

$ go 1.19.1

Does this issue reproduce with the latest release?

yes

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

go env Output
$ GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jimbo/.cache/go-build"
GOENV="/home/jimbo/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jimbo/go/pkg/mod"
GOOS="linux"
GOPATH="/home/jimbo/go"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/shared/dev/myfitnesspal/go.mod"
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-build714340508=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I wrote a http wrapper for the MyFitnessPal API. When I'm trying to get a callback code which is located in the header, I'll get an error message. To reproduce clone the following repository and install the dependencies and then run:

go run main.go

What did you expect to see?

A response with status code 302 and a location header which contains the callback code.

What did you see instead?

I'll get the following error message:

net/url.Error {Op: "Post", URL: "mfp://identity/callback?code=XXXX", Err: error(*errors.errorString) *{s: "http2: unsupported scheme"}}

response variable is nil.

Screenshot 2022-10-04 130932

I know that this "mfp://" url is in headers, because I checked it with a proxy before (see screenshot below)

Screenshot 2022-10-04 130532

It looks like net/http is validating header values, which, if I understood it right, should'nt do it

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