Split HTTP namespace up into http_parser.h and url.h, since the URL library can be useful stand-alone as well.

This commit is contained in:
Thulinma 2020-02-28 11:33:12 +01:00
parent e0dfc3a4db
commit 793f6f7809
7 changed files with 307 additions and 283 deletions

View file

@ -73,28 +73,5 @@ namespace HTTP{
void Trim(std::string &s);
};
/// URL parsing class. Parses full URL into its subcomponents
class URL{
public:
URL(const std::string &url = "");
uint32_t getPort() const;
uint32_t getDefaultPort() const;
std::string getExt() const;
std::string getUrl() const;
std::string getFilePath() const;
std::string getBareUrl() const;
std::string getProxyUrl() const;
std::string host; ///< Hostname or IP address of URL
std::string protocol; ///< Protocol of URL
std::string port; ///< Port of URL
std::string path; ///< Path after the first slash (not inclusive) but before any question mark
std::string args; ///< Everything after the question mark in the path, if it was present
std::string frag; ///< Everything after the # in the path, if it was present
std::string user; ///< Username, if it was present
std::string pass; ///< Password, if it was present
URL link(const std::string &l) const;
bool IPv6Addr;
};
}// namespace HTTP