Merge pull request #949 from harshavardhana/pr_out_add_path_to_if_path_is_null_string

This commit is contained in:
Harshavardhana
2015-07-29 23:28:34 -07:00
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ func (s *MySuite) TestURLParse(c *C) {
c.Assert(err, IsNil)
c.Assert(u.Scheme, Equals, "http")
c.Assert(u.Host, Equals, "s3.example.com")
c.Assert(u.Path, Equals, "")
c.Assert(u.Path, Equals, "/")
u, err = Parse("http://s3.example.com/path/new")
c.Assert(err, IsNil)
+3
View File
@@ -90,6 +90,9 @@ func Parse(urlStr string) (*URL, error) {
if strings.HasPrefix(rest, "//") {
// if rest has '//' prefix, skip them
authority, rest := splitSpecial(rest[2:], "/", false)
if rest == "" {
rest = "/"
}
host := getHost(authority)
if host != "" && (scheme == "http" || scheme == "https") {
return &URL{