fasturl: Remove fragment

This commit is contained in:
Richard Patel 2018-11-06 00:17:10 +01:00
parent ed0d9c681f
commit 9cf31b1d81
No known key found for this signature in database
GPG Key ID: C268B2BBDA2ABECB

View File

@ -366,7 +366,6 @@ type URL struct {
RawPath string // encoded path hint (see EscapedPath method) RawPath string // encoded path hint (see EscapedPath method)
ForceQuery bool // append a query ('?') even if RawQuery is empty ForceQuery bool // append a query ('?') even if RawQuery is empty
RawQuery string // encoded query values, without '?' RawQuery string // encoded query values, without '?'
Fragment string // fragment for references, without '#'
} }
// User returns a Userinfo containing the provided username // User returns a Userinfo containing the provided username
@ -493,9 +492,6 @@ func (u *URL) Parse(rawurl string) error {
if frag == "" { if frag == "" {
return nil return nil
} }
if u.Fragment, err = unescape(frag, encodeFragment); err != nil {
return &Error{"parse", rawurl, err}
}
return nil return nil
} }
@ -814,10 +810,6 @@ func (u *URL) String() string {
buf.WriteByte('?') buf.WriteByte('?')
buf.WriteString(u.RawQuery) buf.WriteString(u.RawQuery)
} }
if u.Fragment != "" {
buf.WriteByte('#')
buf.WriteString(escape(u.Fragment, encodeFragment))
}
return buf.String() return buf.String()
} }
@ -1018,9 +1010,6 @@ func (u *URL) ResolveReference(url *URL, ref *URL) {
} }
if ref.Path == "" && ref.RawQuery == "" { if ref.Path == "" && ref.RawQuery == "" {
url.RawQuery = u.RawQuery url.RawQuery = u.RawQuery
if ref.Fragment == "" {
url.Fragment = u.Fragment
}
} }
// The "abs_path" or "rel_path" cases. // The "abs_path" or "rel_path" cases.
url.Host = u.Host url.Host = u.Host