Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
url.hh
Go to the documentation of this file.
1#pragma once
3
4#include "error.hh"
5
6namespace nix {
7
9{
10 std::string scheme;
11 std::optional<std::string> authority;
12 std::string path;
13 std::map<std::string, std::string> query;
14 std::string fragment;
15
16 std::string to_string() const;
17
18 bool operator ==(const ParsedURL & other) const noexcept;
19
24};
25
26std::ostream & operator << (std::ostream & os, const ParsedURL & url);
27
28MakeError(BadURL, Error);
29
30std::string percentDecode(std::string_view in);
31std::string percentEncode(std::string_view s, std::string_view keep="");
32
33std::map<std::string, std::string> decodeQuery(const std::string & query);
34
35std::string encodeQuery(const std::map<std::string, std::string> & query);
36
37ParsedURL parseURL(const std::string & url);
38
48 std::optional<std::string_view> application;
49 std::string_view transport;
50};
51
52ParsedUrlScheme parseUrlScheme(std::string_view scheme);
53
54/* Detects scp-style uris (e.g. git@github.com:NixOS/nix) and fixes
55 them by removing the `:` and assuming a scheme of `ssh://`. Also
56 changes absolute paths into file:// URLs. */
57std::string fixGitURL(const std::string & url);
58
66bool isValidSchemeName(std::string_view scheme);
67
68}
This file defines two main structs/classes used in nix error handling.
return s
Definition lexer.l:459
Definition url.hh:9
ParsedURL canonicalise()
Definition url.cc:152
Definition url.hh:47