Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
url.hh File Reference
#include "error.hh"

Go to the source code of this file.

Classes

struct  nix::ParsedURL
 
struct  nix::ParsedUrlScheme
 

Functions

std::ostream & nix::operator<< (std::ostream &os, const ParsedURL &url)
 
 nix::MakeError (BadURL, Error)
 
std::string nix::percentDecode (std::string_view in)
 
std::string nix::percentEncode (std::string_view s, std::string_view keep)
 
std::map< std::string, std::string > nix::decodeQuery (const std::string &query)
 
std::string nix::encodeQuery (const std::map< std::string, std::string > &ss)
 
ParsedURL nix::parseURL (const std::string &url)
 
ParsedUrlScheme nix::parseUrlScheme (std::string_view scheme)
 
std::string nix::fixGitURL (const std::string &url)
 
bool nix::isValidSchemeName (std::string_view s)
 

Function Documentation

◆ isValidSchemeName()

bool nix::isValidSchemeName ( std::string_view scheme)

Whether a string is valid as RFC 3986 scheme name. Colon : is part of the URI; not the scheme name, and therefore rejected. See https://www.rfc-editor.org/rfc/rfc3986#section-3.1

Does not check whether the scheme is understood, as that's context-dependent.

◆ parseUrlScheme()

ParsedUrlScheme nix::parseUrlScheme ( std::string_view scheme)

Parse a URL scheme of the form '(applicationScheme+)?transportScheme' into a tuple '(applicationScheme, transportScheme)'

parseUrlScheme("http") == ParsedUrlScheme{ {}, "http"} parseUrlScheme("tarball+http") == ParsedUrlScheme{ {"tarball"}, "http"}