DEV Community

Discussion on: Constructing uris in dotnet is harder than it should

Collapse
 
moejoe profile image
Moritz Haslhofer

i was annoyed too, until someone pointed out to me, that shockingly, this is the specified behavior by tools.ietf.org/html/rfc3986#sectio...

For the first two examples:

as far as i understand, the left url-part - if not ending in a / - could be a container or a file.

from an urls perspective there is no difference between host.io/foo and host.io/foo.html.

So the merging algorithm cuts everything on the left side, after the last slash.

For the 3rd and 4th example:

If the right url-part start with an "/" it is assumed that it is an absoulte path (starting with the resource-servers root).

So any path part after the root of the left side is cut.