feat: use libpsl (#2575)

Use libpsl to calculate public and private parts of URL hosts.
This commit is contained in:
Charles Kerr
2022-02-12 11:30:27 -06:00
committed by GitHub
parent 708fc1531e
commit e14c7f38e5
33 changed files with 538 additions and 406 deletions

View File

@@ -24,15 +24,18 @@ bool tr_urlIsValid(std::string_view url);
struct tr_url_parsed_t
{
std::string_view scheme;
std::string_view authority;
std::string_view host;
std::string_view path;
std::string_view portstr;
std::string_view query;
std::string_view fragment;
std::string_view full;
int port = -1;
// http://example.com:80/over/there?name=ferret#nose
std::string_view scheme; // "http"
std::string_view authority; // "example.com:80"
std::string_view host; // "example.com"
std::string_view sitename; // "example"
std::string_view portstr; // "80"
std::string_view path; // /"over/there"
std::string_view query; // "name=ferret"
std::string_view fragment; // "nose"
std::string_view full; // "http://example.com:80/over/there?name=ferret#nose"
int port = -1; // 80
};
std::optional<tr_url_parsed_t> tr_urlParse(std::string_view url);