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/url: setting Opaque ignores Host value on String #20421
Comments
Just curious why you think it should be displayed that way? |
You are correct that the documentation clearly states that the host is not part of the opaque. I should have given some more background information when creating this issue. I thought the behavior was incorrect because when you include the host part in the Opaque your HTTP request would result in a different request (not necessarily invalid) than when the Opaque would not be set. Using the http.Request.URL value returns unexpected results. Example: No Opaque:
With host duplicated in Opaque:
But according to rfc3986:
So according to the name 'opaque' it's not invalid but it leads to unexpected results for regular use cases. Unfortunately, it was required to use url.URL with Opaque when the URL contains any special encoding, especially base64 which could include an encoded / (%2F) where the encoding will be removed and threaded as a directory. But when I just tested this it doesn't look to be a problem anymore, so or I got confused about what character caused the problem or it was resolved in a go release since I wrote this code a couple of years back... I will try to dive into my archives and try to replicate the original issue that forced us to use Opaque. |
The fix using Opaque was implemented about two years ago. Just verified with tcpdump and the original problem looks to be resolved in the current go version. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.8.1 linux/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/opt/gopkg"
GORACE=""
GOROOT="/opt/go"
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
https://play.golang.org/p/WWaneBpjNX
What did you expect to see?
http://ocsp.int-x3.letsencrypt.org/opaque-set-in-url
What did you see instead?
http:/opaque-set-in-url
The text was updated successfully, but these errors were encountered: