Skip to content

Changes to Url to get it more in line with URI spec #440

Description

@tmenier

Flurl.Url parses a URL string into its parts which it exposes as properties, namely Path, Query, and Fragment. These are roughly equivalent to the formally defined parts of a URI, with some major exceptions:

  • Stuff on the front part of the URI (sheme, host, etc) are notably missing.
  • BREAKING: Flurl's notion of Path is not at all consistent with the URI definition, as it includes everything except the query and fragment.

I'd like to get Flurl.Url a little closer to System.Uri, although that has at least one known quirk of its own: Authority does not include user info, if provided.

This change would (re)define the following properties on Url:

  • Scheme (new)
  • UserInfo (new)
  • Host (new)
  • Port (new)
  • Path (breaking change)
  • PathSegments (new)
  • Query (same as current)
  • Fragment (same as current)
  • Authority (new, derived: UserInfo + HostName + Port)
  • Root (new, derived: Scheme + Authority)

Also:

  • new static Url.Parse method, which is just syntactic sugar for new Url(string)
  • BREAKING: GetRoot() is removed, use Root property going forward

References (to make sure I get all the details right):
https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Definition
https://stackoverflow.com/questions/2142910/whats-the-difference-between-uri-host-and-uri-authority

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions