]> Cypherpunks repositories - gostls13.git/commit
net/url: better path resolution
authorRodrigo Moraes de Oliveira <rodrigo.moraes@gmail.com>
Mon, 11 Mar 2013 19:03:07 +0000 (15:03 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 11 Mar 2013 19:03:07 +0000 (15:03 -0400)
commit82e3ca7b7a1f7401e02d227f06c8b208a90c775b
treec2b62c8d74f90c22bd0e2d40bf9515580b41fa02
parentc67d3739b70594cbbc37c64cc0133f114890e286
net/url: better path resolution

This includes a simplified resolvePath function and tests for all normal and abnormal path resolution examples described in RFC 3986, sections 5.4.1 and 5.4.2 [1]. Some of those examples failed before (see http://play.golang.org/p/F0ApSaXniv).

Also, parsing a reference "//foo" now works as expected. It was treated as an absolute path with very weird results (see http://play.golang.org/p/089b-_xoNe).

During path resolution, all dot segments are removed as described by the RFC.

A few existing tests had to be changed because they expected the wrong output.

Fixes #4700.

Fixes #4706.

[1] http://tools.ietf.org/html/rfc3986#section-5.4.1

R=rsc, adg, bradfitz
CC=golang-dev
https://golang.org/cl/7203059
src/pkg/net/url/url.go
src/pkg/net/url/url_test.go