From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2021-10-14 00:25:02


On 10/14/21 2:52 AM, Vinnie Falco via Boost wrote:
> On Wed, Oct 13, 2021 at 4:09 PM Gavin Lambert via Boost
> <boost_at_[hidden]> wrote:
>> ...
>
> Given the following path:
>
> /path/to/file.txt
>
> What should iterating the segments return?
>
> { "path", "to", "file.txt" }
> or
> { "/path", "/to", "/file.txt" }
>
> or something else?
>
> Given this path:
>
> my/download/folder/
>
> What should iterating the segments return?
>
> { "my", "download", "folder", "" }
> or
> { "my/", "download/", "folder/" }
> or
> { "my", "/download", "/folder", "/" }
>
> or something else?
>
> Given an empty relative-ref (empty string) in a url u, what is the
> encoded path after executing this statement?
>
> u.segments().push_back( "index.htm" );
>
> Anyone feel free to answer!

If std::filesystem::path is an example to follow then path elements
should not contain path separators, except the root directory. The
trailing separator is indicated by an empty final element. So:

  /my/download/folder/

would correspond to:

  { "/", "my", "download", "folder", "" }

and

  /path/to/file.txt

to

  { "/", "path", "to", "file.txt" }

I think, URL paths must always have the root directory as the leading
slash is a necessary separator from the host and port, so you could
probably omit it from the list of elements.