cpp-netlib/uri

Adding a path to a url without the leading / separator produces an invalid url

Closed this issue · 2 comments

I'm not sure if this is really a bug - more of a nice to have - but implementing it would seem trivial. The problem is that in order to fetch named files on the root directory of an FTP server I typically have to prepend a root separator before the name of the file as typically files listed from the FTP server do not individually have the leading separator character. I typically do the following:

memBufferPath = fs::path("/") / iter->getPath();

Given that the optional path() component is not present (it is optional) could you add logic to prepend the / separator if the specified path does not already contain one?

network::uri_builder bldr;
bldr.scheme("ftp")
    .host("192.168.1.1")
    .path("default_path.ext");
network::uri uri = bldr.uri();
std::cout << uri << std::endl;

prints the following

ftp://192.168.1.1default_path.ext

Thanks. This is indeed odd behaviour. I'll take a look.

Great, once you get a patch, let me know and I'll test it out for you

On Wed, Apr 2, 2014 at 4:19 PM, Glyn Matthews notifications@github.comwrote:

Thanks. This is indeed odd behaviour. I'll take a look.

Reply to this email directly or view it on GitHubhttps://github.com//issues/50#issuecomment-39378268
.