Commit 96d33210 authored by hydratim's avatar hydratim

Fix for "Invalid port" thrown by headers_test.host

parent 3366df11
......@@ -360,9 +360,11 @@ Host::parse(const std::string& data) {
}
char *end;
const std::string portPart = data.substr(pos + 1);
long port;
if (portPart.empty())
throw std::invalid_argument("Invalid port");
long port = strtol(portPart.c_str(), &end, 10);
port = HTTP_STANDARD_PORT;
else
port = strtol(portPart.c_str(), &end, 10);
if (*end != 0 || port < Port::min() || port > Port::max())
throw std::invalid_argument("Invalid port");
port_ = static_cast<uint16_t>(port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment