How-To work with URLs

The library provides very simple URL parsing via the liberate::net::url class.

Warning

The URL parsing provided here is in no way standards conforming. It exists soley to have a uniform syntax for simple things like socket addresses that can also span local AF_UNIX sockets.

Parse a URL
 1#include <liberate/net/url.h>
 2
 3liberate::net::url url{"https://example.com/foo/bar?asdf=1#blah"};
 4
 5assert(url.scheme == "https");
 6assert(url.authority == "example.com");
 7assert(url.path == "/foo/bar");
 8auto iter = url.query.find("asdf");
 9assert(iter != url.query.end());
10assert(iter->second == "1");
11assert(url.fragment == "blah");

URLs are hashable and comparable.