2020-03-30 17:04:18 +03:00
|
|
|
#pragma once
|
|
|
|
|
2020-05-12 00:52:15 +03:00
|
|
|
#include "error.hh"
|
2020-03-30 17:04:18 +03:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
struct ParsedURL
|
|
|
|
{
|
|
|
|
std::string url;
|
|
|
|
std::string base; // URL without query/fragment
|
|
|
|
std::string scheme;
|
|
|
|
std::optional<std::string> authority;
|
|
|
|
std::string path;
|
|
|
|
std::map<std::string, std::string> query;
|
|
|
|
std::string fragment;
|
|
|
|
|
|
|
|
std::string to_string() const;
|
|
|
|
|
|
|
|
bool operator ==(const ParsedURL & other) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
MakeError(BadURL, Error);
|
|
|
|
|
|
|
|
std::string percentDecode(std::string_view in);
|
|
|
|
|
|
|
|
std::map<std::string, std::string> decodeQuery(const std::string & query);
|
|
|
|
|
|
|
|
ParsedURL parseURL(const std::string & url);
|
|
|
|
|
|
|
|
}
|