aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/fetchers/parse.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/fetchers/parse.hh')
-rw-r--r--src/libstore/fetchers/parse.hh28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/libstore/fetchers/parse.hh b/src/libstore/fetchers/parse.hh
new file mode 100644
index 000000000..22cc57816
--- /dev/null
+++ b/src/libstore/fetchers/parse.hh
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "types.hh"
+
+namespace nix::fetchers {
+
+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;
+};
+
+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);
+
+}