]> Cypherpunks repositories - gostls13.git/commitdiff
net/url: add tests for RequestURI returning //paths
authorRuss Cox <rsc@golang.org>
Fri, 4 Dec 2015 17:28:15 +0000 (12:28 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 10 Dec 2015 20:03:03 +0000 (20:03 +0000)
Fixes #10433.

Change-Id: I2a8b54e3f07488f204b1d14eb2603842caaf1e5a
Reviewed-on: https://go-review.googlesource.com/17386
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/url/url_test.go

index da022f20d412141dc1b97b89b6895e2ad1b116c4..b1c3ceb0b7168270169fb8435afe4b0a51269771 100644 (file)
@@ -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
@@ -1178,6 +1188,14 @@ var requritests = []RequestURITest{
                },
                "opaque?q=go+language",
        },
+       {
+               &URL{
+                       Scheme: "http",
+                       Host:   "example.com",
+                       Path:   "//foo",
+               },
+               "//foo",
+       },
 }
 
 func TestRequestURI(t *testing.T) {