Skip to content

net/http: NewRequest cannot handle %2F in path #5777

Closed
@gopherbot

Description

@gopherbot

by rjohnson.id.au:

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions