Skip to content

net/url: '?' in userinfo is not escaped properly #6573

@zombiezen

Description

@zombiezen
What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. http://play.golang.org/p/ZLKGKTuDbS

What is the expected output?
String: http://a?@a/bar
Parsed: &url.URL{Scheme:"http", Opaque:"",
User:(*url.Userinfo)(url.User("a?")), Host:"a",
Path:"/bar", RawQuery:"", Fragment:""}

What do you see instead?
String: http://a?@a/bar
Parsed: &url.URL{Scheme:"http", Opaque:"",
User:(*url.Userinfo)(nil), Host:"a", Path:"",
RawQuery:"@a/bar", Fragment:""}

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Linux amd64

Which version are you using?  (run 'go version')
go version go1.1.2 linux/amd64
(but reproducible on tip)

Please provide any additional information below.

Attached patch fixes the issue, seems like an oversight.

Attachments:

  1. escape-userinfo.diff (533 bytes)

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