mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 07:22:43 +01:00
Merge pull request #13795 from xokdvium/factor-out-s3url
libstore: Introduce ParsedS3URL type
This commit is contained in:
commit
088cc176f1
8 changed files with 212 additions and 28 deletions
|
|
@ -30,7 +30,7 @@ struct ParsedURL
|
|||
};
|
||||
|
||||
static Authority parse(std::string_view encodedAuthority);
|
||||
bool operator==(const Authority & other) const = default;
|
||||
auto operator<=>(const Authority & other) const = default;
|
||||
std::string to_string() const;
|
||||
friend std::ostream & operator<<(std::ostream & os, const Authority & self);
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ struct ParsedURL
|
|||
|
||||
std::string to_string() const;
|
||||
|
||||
bool operator==(const ParsedURL & other) const noexcept = default;
|
||||
auto operator<=>(const ParsedURL & other) const noexcept = default;
|
||||
|
||||
/**
|
||||
* Remove `.` and `..` path elements.
|
||||
|
|
@ -111,7 +111,7 @@ std::string encodeQuery(const StringMap & query);
|
|||
*
|
||||
* @throws BadURL
|
||||
*/
|
||||
ParsedURL parseURL(const std::string & url);
|
||||
ParsedURL parseURL(std::string_view url);
|
||||
|
||||
/**
|
||||
* Although that’s not really standardized anywhere, an number of tools
|
||||
|
|
|
|||
|
|
@ -108,10 +108,8 @@ static std::string percentEncodeCharSet(std::string_view s, auto charSet)
|
|||
return res;
|
||||
}
|
||||
|
||||
ParsedURL parseURL(const std::string & url)
|
||||
ParsedURL parseURL(std::string_view url)
|
||||
try {
|
||||
auto unparsedView = url;
|
||||
|
||||
/* Account for several non-standard properties of nix urls (for back-compat):
|
||||
* - Allow unescaped spaces ' ' and '"' characters in queries.
|
||||
* - Allow '"', ' ' and '^' characters in the fragment component.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue