mirror of
https://github.com/NixOS/nix
synced 2025-07-05 16:31:47 +02:00
ParsedURL: Remove url field
This prevents a 'url' field that is out of sync with the other fields. You can use to_string() to get the full URL.
This commit is contained in:
parent
a0901e5588
commit
f705ce7f9a
8 changed files with 25 additions and 43 deletions
|
@ -40,7 +40,6 @@ ParsedURL parseURL(const std::string & url)
|
|||
path = "/";
|
||||
|
||||
return ParsedURL{
|
||||
.url = url,
|
||||
.base = base,
|
||||
.scheme = scheme,
|
||||
.authority = authority,
|
||||
|
@ -136,6 +135,12 @@ std::string ParsedURL::to_string() const
|
|||
+ (fragment.empty() ? "" : "#" + percentEncode(fragment));
|
||||
}
|
||||
|
||||
std::ostream & operator << (std::ostream & os, const ParsedURL & url)
|
||||
{
|
||||
os << url.to_string();
|
||||
return os;
|
||||
}
|
||||
|
||||
bool ParsedURL::operator ==(const ParsedURL & other) const noexcept
|
||||
{
|
||||
return
|
||||
|
|
|
@ -7,9 +7,8 @@ namespace nix {
|
|||
|
||||
struct ParsedURL
|
||||
{
|
||||
std::string url;
|
||||
/// URL without query/fragment
|
||||
std::string base;
|
||||
std::string base; // FIXME: remove
|
||||
std::string scheme;
|
||||
std::optional<std::string> authority;
|
||||
std::string path;
|
||||
|
@ -26,6 +25,8 @@ struct ParsedURL
|
|||
ParsedURL canonicalise();
|
||||
};
|
||||
|
||||
std::ostream & operator << (std::ostream & os, const ParsedURL & url);
|
||||
|
||||
MakeError(BadURL, Error);
|
||||
|
||||
std::string percentDecode(std::string_view in);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue