Boost logo

Boost :

From: Gavin Lambert (boost_at_[hidden])
Date: 2021-10-17 21:51:28


On 17/10/2021 07:53, Vinnie Falco wrote:
> What should the resulting encoded URL be? Well a naive algorithm might
> leave us with "https://index.htm" but this is clearly wrong, as
> index.htm is now the host! To fix this, the library prepends "/." to
> the path (this is guidance from rfc3986):
>
> assert( u.encoded_url() == "https:/.//index.htm" );

I assume this was intended to be "https://./index.htm"?

> There are a handful of other cases like this (for example, removing
> the scheme from a relative-ref whose first segment has a colon).
> Coming back to:
>
> abs("/././/", { ".", "", "" });
>
> We treat a leading "/." as not appearing in the segments, to make the
> behavior of the library doing these syntactic adjustments transparent
> and satisfy the rule that assignments from segments produce the same
> result when iterated.

If you're stripping leading ./ then shouldn't the result just be "/" alone?

Same reason that "/../../foo/../bar/" should become "/bar/".


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk