Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::ParsedURL::Authority Struct Reference

#include <url.hh>

Public Types

enum class  HostType { Name , IPv4 , IPv6 , IPvFuture }

Public Member Functions

auto operator<=> (const Authority &other) const =default
std::string to_string () const

Static Public Member Functions

static Authority parse (std::string_view encodedAuthority)

Public Attributes

HostType hostType = HostType::Name
std::string host
std::optional< std::string > user
std::optional< std::string > password
std::optional< uint16_t > port

Friends

std::ostream & operator<< (std::ostream &os, const Authority &self)

Detailed Description

Parsed representation of a URL authority.

It consists of user information, hostname and an optional port number. Note that passwords in the userinfo are not yet supported and are ignored.

Todo
Maybe support passwords in userinfo part of the url for auth.

Member Data Documentation

◆ host

std::string nix::ParsedURL::Authority::host

Host subcomponent. Either a registered name or IPv{4,6,Future} literal addresses.

IPv6 enclosing brackets are already stripped. Percent encoded characters in the hostname are decoded.

◆ hostType

HostType nix::ParsedURL::Authority::hostType = HostType::Name

Type of the host subcomponent, as specified by rfc3986 3.2.2. Host.

◆ password

std::optional<std::string> nix::ParsedURL::Authority::password

Password subcomponent of the authority (if specified).

Warning
As per the rfc3986, the password syntax is deprecated, but it's necessary to make the parse -> to_string roundtrip. We don't use it anywhere (at least intentionally).
Todo
Warn about unused password subcomponent.

◆ port

std::optional<uint16_t> nix::ParsedURL::Authority::port

Port subcomponent (if specified). Default value is determined by the scheme.

◆ user

std::optional<std::string> nix::ParsedURL::Authority::user

Percent-decoded user part of the userinfo.


The documentation for this struct was generated from the following files:
  • libutil/include/nix/util/url.hh
  • libutil/url.cc