You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
urlStr := "http://myhost.com/test%2Fasdf/";
req, _ = http.NewRequest("GET", urlStr, nil)
client := new(http.Client)
resp, err := client.Do(req)
What is the expected output?
A request to "http://myhost.com/test%2Fasdf/";
What do you see instead?
A request to "http://myhost.com/test/asdf/";
Which compiler are you using (5g, 6g, 8g, gccgo)?
N/A, but 6g
Please provide any additional information below.
Unfortunately it appears that http.NewRequest uses url.Parse, which suffers from this
issue: https://golang.org/issue/3659
I would not have added an additional bug, however the original bug seems to have been
closed with the status "Fixed" due to the documentation being updated to
reflect this. Clearly this is not the correct fix for the issue.
The text was updated successfully, but these errors were encountered:
I've gone with:
req, _ = http.NewRequest(verb, reqAddress, buf)
path := strings.TrimPrefix(req.URL.Scheme, reqAddress)
path = strings.Split(reqAddress, "?")[0]
req.URL.Opaque = path
Which is essentially re-parsing the path out.
I feel that if URL.Parse is not to be updated, than http.Request should probably do
something like this? This issue would present itself again without a workaround if
there were a %2F in a redirect for example.
I see more and more REST services that use %2F in path elements that correspond to variables, and therefore more and more reports like this one. I am reopening this for a possible fix in the Go 1.5 cycle. I have a fix in mind.
by rjohnson.id.au:
The text was updated successfully, but these errors were encountered: