Skip to content
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

Should URLEscape convert space characters to '+' or '%20'? #502

Closed
hoisie opened this issue Jan 7, 2010 · 2 comments
Closed

Should URLEscape convert space characters to '+' or '%20'? #502

hoisie opened this issue Jan 7, 2010 · 2 comments

Comments

@hoisie
Copy link
Contributor

hoisie commented Jan 7, 2010

I have a small program trying to download the following file, via http.Get:

http://www.sfmta.com/cms/uploadedfiles/dpt/bike/Safety/Chapter%202_General%
20Bicycle%20Rules.pdf

When http.Get handles the url, the combination of http.URLUnescape (in 
http.ParseURL) and http.URLEscape (in req.Write) converts the url into 
this:

http://www.sfmta.com/cms/uploadedfiles/dpt/bike/Safety/Chapter+2_General+Bi
cycle+Rules.pdf

However, that link returns a 404. 

Is there a reason why %20 is converted to '+'? Would it be safer to use 
%20? 

Relevant code is here:

package main

import "http"

func main() {
        rawurl := 
`http://www.sfmta.com/cms/uploadedfiles/dpt/bike/Safety/Chapter%202_General
%20Bicy
cle%20Rules.pdf`
        url,err := http.ParseURL (rawurl )
        if err != nil {
                println("error parsing", err)
        }
        println("Final url", url.String())

        resp,_,err := http.Get ( rawurl )
        if err != nil {
                println("error downlaoding", err.String())
        }
        println(resp.StatusCode);

}
@hoisie
Copy link
Contributor Author

hoisie commented Jan 7, 2010

@rsc
Copy link
Contributor

rsc commented Jan 8, 2010

Comment 2:

This issue was closed by revision fe56e2c.

Status changed to Fixed.

Merged into issue #-.

@hoisie hoisie added the fixed label Jan 8, 2010
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants