http: fix scheme-relative URL parsing; add ParseRequestURL
Also adds some tests for Issue 900 which was the reason
the current URL parsing is broken. (the previous fix
was wrong)
Sorry for the runaround but I think you need to tell ParseURL to do the ...
13 years, 10 months ago
(2011-01-11 20:18:11 UTC)
#5
Sorry for the runaround but I think you
need to tell ParseURL to do the right thing.
I was looking just now at whether prefix should
be urlUnescaped before adding it to the beginning
of url.Path. The answer is that it should, except
that if there were escaped characters then ParseURL
rejected the URL as having an invalid authority.
That is, I believe GET //%66%6f%6f should end up
asking for //foo, but I think ParseURL will just reject it
because %66%6f%6f is a bogus authority.
I suggest renaming ParseURL to parseURL and
adding a bool flag saying whether to assume the
HTTP behavior.
Then ParseURL is parseURL(url, false) and
ParseRequestURL is parseURL(url, true).
Russ
Yeah, sounds good. I was talking with adg about going that route too. Will update. ...
13 years, 10 months ago
(2011-01-11 20:24:37 UTC)
#6
Yeah, sounds good. I was talking with adg about going that route too. Will
update.
On Tue, Jan 11, 2011 at 12:18 PM, Russ Cox <rsc@golang.org> wrote:
> Sorry for the runaround but I think you
> need to tell ParseURL to do the right thing.
> I was looking just now at whether prefix should
> be urlUnescaped before adding it to the beginning
> of url.Path. The answer is that it should, except
> that if there were escaped characters then ParseURL
> rejected the URL as having an invalid authority.
>
> That is, I believe GET //%66%6f%6f should end up
> asking for //foo, but I think ParseURL will just reject it
> because %66%6f%6f is a bogus authority.
>
> I suggest renaming ParseURL to parseURL and
> adding a bool flag saying whether to assume the
> HTTP behavior.
>
> Then ParseURL is parseURL(url, false) and
> ParseRequestURL is parseURL(url, true).
>
> Russ
>
Issue 3910042: code review 3910042: http: fix scheme-relative URL parsing; add ParseRequestURL
(Closed)
Created 13 years, 10 months ago by brad_danga_com
Modified 13 years, 10 months ago
Reviewers:
Base URL:
Comments: 8