You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
930 B

#ifndef URL_H
#define URL_H
#include <string>
#include <memory>
#include <iostream>
enum URIParseError {
struct URL {
URL(std::string const& url);
void setPort();
std::string toString() const;
bool isRelative() const;
URL merge(URL const& url) const;
// switching to the official RFC names
std::string scheme; // was protocol
//struct Authority authority; /* Can be empty */
std::string userinfo;
std::string host;
int port;
std::string path; // was document
std::string query; // ?blablabla=asdfasf....
std::string fragment; // #asfawefm
void construct(std::string const& url);
URL copy() const;
std::tuple<std::unique_ptr<URL>,enum URIParseError> parseUri(std::string raw);
std::ostream& operator<<(std::ostream& out, URL const& url);