Thoth
A functional, expressive, asynchronous C++26 webdev library
Loading...
Searching...
No Matches
Thoth::Http::Url Struct Reference

#include <Url.hpp>

Public Member Functions

bool IsSecure () const
 Check if the scheme is https.
 
bool operator== (const Url &) const
 

Static Public Member Functions

static std::expected< Url, RequestErrorFromUrl (string_view rawUrl)
 Tries to convert the given string into URL.
 
static string Encode (string_view str)
 Encodes a text with Percent-Encoding.
 
static std::expected< string, RequestErrorTryDecode (string_view str)
 Tries to decode the text with Percent-Encoding.
 

Public Attributes

string scheme {}
 the given scheme. Can be "http" or "https" (it's "empty" after all).
 
string user {}
 the userinfo of the URL, the optional part between the scheme and the host. eg: https://userinfo@@localhost.
 
string host {}
 the hostname of the URL.
 
int port {}
 the port of the URL. Goes from 0 to 65.535.
 
string path {}
 the path of the URL.
 
QueryParams query {}
 the query of the URL.
 
string fragment {}
 the fragment of the URL. Normally ignored in server side.
 

Friends

class std::formatter< Url >
 

Member Function Documentation

◆ Encode()

static string Thoth::Http::Url::Encode ( string_view  str)
static

Encodes a text with Percent-Encoding.

Parameters
strthe given text.
Returns
The string encoded.

◆ FromUrl()

static std::expected< Url, RequestError > Thoth::Http::Url::FromUrl ( string_view  rawUrl)
static

Tries to convert the given string into URL.

Parameters
rawUrlthe given URL.
Returns
The Url if succeeded, std::nullopt if it fails.

◆ IsSecure()

bool Thoth::Http::Url::IsSecure ( ) const

Check if the scheme is https.

◆ operator==()

bool Thoth::Http::Url::operator== ( const Url ) const

◆ TryDecode()

static std::expected< string, RequestError > Thoth::Http::Url::TryDecode ( string_view  str)
static

Tries to decode the text with Percent-Encoding.

Parameters
strthe given text.
Returns
The string decoded if it succeeded, std::nullopt if it fails.

Friends And Related Symbol Documentation

◆ std::formatter< Url >

friend class std::formatter< Url >
friend

Member Data Documentation

◆ fragment

string Thoth::Http::Url::fragment {}

the fragment of the URL. Normally ignored in server side.

◆ host

string Thoth::Http::Url::host {}

the hostname of the URL.

◆ path

string Thoth::Http::Url::path {}

the path of the URL.

◆ port

int Thoth::Http::Url::port {}

the port of the URL. Goes from 0 to 65.535.

◆ query

QueryParams Thoth::Http::Url::query {}

the query of the URL.

◆ scheme

string Thoth::Http::Url::scheme {}

the given scheme. Can be "http" or "https" (it's "empty" after all).

◆ user

string Thoth::Http::Url::user {}

the userinfo of the URL, the optional part between the scheme and the host. eg: https://userinfo@@localhost.


The documentation for this struct was generated from the following file: