Unreviewed changes
1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: src/net/url/url.go
Insertions: 3, Deletions: 0.
@@ -841,6 +841,9 @@
}
path := u.EscapedPath()
if u.OmitHost && u.Host == "" && u.User == nil && strings.HasPrefix(path, "//") {
+ // Escape the first / in a path starting with "//" and no authority
+ // so that re-parsing the URL doesn't turn the path into an authority
+ // (e.g., Path="//host/p" producing "http://host/p").
buf.WriteString("%2F")
path = path[1:]
}
```
Change information
Commit message:
net/url: escape // at start of Path when OmitHost set
When a URL has OmitHost set and a Path starting with //,
escape the first / in the path to avoid emitting a URL
with the host set from the Path.
For example for
u := url.URL{Scheme: "file", OmitHost: true, Path: "//host/path"}
u.String is now "file:%2F/host/path", not "file://host/path".
Fixes #78328
Change-Id: I017af26724cc55f8b7e6f7c969f1495b6a6a6964
Files:
- M src/net/url/url.go
- M src/net/url/url_test.go
Change size: S
Delta: 2 files changed, 32 insertions(+), 5 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Code-Review: +2 by Alan Donovan
TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI