Browse Source

default port is 0, as in Webclient's c'tor. URL schema is always returned in lowercase now.

pull/2/head
roker 1 year ago
parent
commit
78a97d3116
2 changed files with 11 additions and 2 deletions
  1. +9
    -0
      url_parser.cc
  2. +2
    -2
      url_parser.hh

+ 9
- 0
url_parser.cc View File

@ -62,6 +62,15 @@ URL parse_url(const char* begin, const char* end)
{
throw std::runtime_error("Cannot parse URL <" + std::string(begin,end) + "> !");
}
// stolen from pEpMIME's ascii_tolower():
for(char& c : url.schema)
{
if(c>='A' && c<='Z')
{
c += 32;
}
}
return url;
}


+ 2
- 2
url_parser.hh View File

@ -7,11 +7,11 @@ namespace pEp
struct URL
{
std::string schema; // http/https
std::string schema; // http/https. parse_url() returns it always in lowercase
std::string username;
std::string password;
std::string host;
int port = -1;
int port = 0; // port 0 means: default port: 80 for HTTP, 443 for HTTPS
std::string path_and_query = "/"; // no need to split them down anymore
std::string fragment;
};


Loading…
Cancel
Save