]> Cypherpunks repositories - gostls13.git/commit
net/url: add OmitHost bool to url.URL
authorUzondu Enudeme <uzondu@orijtech.com>
Wed, 9 Mar 2022 23:08:52 +0000 (00:08 +0100)
committerEmmanuel Odeke <emmanuel@orijtech.com>
Mon, 14 Mar 2022 09:19:01 +0000 (09:19 +0000)
commitab0f7611d739fe10d0265dbc6bdc17684423bfc8
tree35f325cec930d030e1bfd3257affa69383c736b4
parent3c2e73c8c3323887e6b95f72adb6242b8727ba8b
net/url: add OmitHost bool to url.URL

Previously, myscheme:/path and myscheme:///path were treated as the same URL
although materially different. The distinction made clear by RFC 3986 sec. 5.3 where
a different recomposition behavior is expected when a URI reference has an undefined
host(authority) as in myscheme:/path vs. one with an empty host(authority)
as in myscheme:///path.

This change fixes the Parse/String roundtrip limitation for URLs with an undefined
host and a single slash.

Fixes #46059

Change-Id: I1b8d6042135513616374ff8c8dfb1cdb640f8efe
Reviewed-on: https://go-review.googlesource.com/c/go/+/391294
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/net/url/url.go
src/net/url/url_test.go