Cuberite
A lightweight, fast and extensible game server for Minecraft
Static Public Member Functions | List of all members
cUrlParser Class Reference

#include <UrlParser.h>

Static Public Member Functions

static UInt16 GetDefaultPort (const AString &a_Scheme)
 Returns the default port used by the specified scheme / protocol. More...
 
static bool IsKnownScheme (const AString &a_Scheme)
 Returns true if the specified scheme (http, ftp, mailto, ...) is recognized by the URL parser. More...
 
static std::pair< bool, AStringParse (const AString &a_Url, AString &a_Scheme, AString &a_Username, AString &a_Password, AString &a_Host, UInt16 &a_Port, AString &a_Path, AString &a_Query, AString &a_Fragment)
 Parses the given URL into individual components. More...
 
static std::pair< bool, AStringParseAuthorityPart (const AString &a_AuthorityPart, AString &a_Username, AString &a_Password, AString &a_Host, UInt16 &a_Port)
 Parses the given Authority part of an URL into individual components. More...
 
static std::pair< bool, AStringValidate (const AString &a_Url)
 Checks if the supplied URL is valid. More...
 

Detailed Description

Definition at line 16 of file UrlParser.h.

Member Function Documentation

◆ GetDefaultPort()

UInt16 cUrlParser::GetDefaultPort ( const AString a_Scheme)
static

Returns the default port used by the specified scheme / protocol.

If the scheme is not known, 0 is returned.

Definition at line 14 of file UrlParser.cpp.

◆ IsKnownScheme()

static bool cUrlParser::IsKnownScheme ( const AString a_Scheme)
inlinestatic

Returns true if the specified scheme (http, ftp, mailto, ...) is recognized by the URL parser.

Is case sensitive, known schemes are always lowercase.

Definition at line 21 of file UrlParser.h.

◆ Parse()

std::pair< bool, AString > cUrlParser::Parse ( const AString a_Url,
AString a_Scheme,
AString a_Username,
AString a_Password,
AString a_Host,
UInt16 a_Port,
AString a_Path,
AString a_Query,
AString a_Fragment 
)
static

Parses the given URL into individual components.

Returns true on success, returns false and error message on failure. Fails if the scheme (protocol) is not known. If port is missing, the default port for the specific scheme is applied.

Definition at line 117 of file UrlParser.cpp.

◆ ParseAuthorityPart()

std::pair< bool, AString > cUrlParser::ParseAuthorityPart ( const AString a_AuthorityPart,
AString a_Username,
AString a_Password,
AString a_Host,
UInt16 a_Port 
)
static

Parses the given Authority part of an URL into individual components.

Returns true on success, returns false and error message on failure.

Definition at line 39 of file UrlParser.cpp.

◆ Validate()

std::pair< bool, AString > cUrlParser::Validate ( const AString a_Url)
static

Checks if the supplied URL is valid.

Definition at line 202 of file UrlParser.cpp.


The documentation for this class was generated from the following files: