Commit 503cbcef authored by Russ Cox's avatar Russ Cox

net/url: add tests for RequestURI returning //paths

Fixes #10433.

Change-Id: I2a8b54e3f07488f204b1d14eb2603842caaf1e5a
Reviewed-on: https://go-review.googlesource.com/17386Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 4f97ec08
...@@ -511,6 +511,16 @@ var urltests = []URLTest{ ...@@ -511,6 +511,16 @@ var urltests = []URLTest{
}, },
"", "",
}, },
// golang.org/issue/10433 (path beginning with //)
{
"http://example.com//foo",
&URL{
Scheme: "http",
Host: "example.com",
Path: "//foo",
},
"",
},
} }
// more useful string for debugging than fmt's struct printer // more useful string for debugging than fmt's struct printer
...@@ -1178,6 +1188,14 @@ var requritests = []RequestURITest{ ...@@ -1178,6 +1188,14 @@ var requritests = []RequestURITest{
}, },
"opaque?q=go+language", "opaque?q=go+language",
}, },
{
&URL{
Scheme: "http",
Host: "example.com",
Path: "//foo",
},
"//foo",
},
} }
func TestRequestURI(t *testing.T) { func TestRequestURI(t *testing.T) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment