Codechange: split ParseConnectionString into two functions

One also looks for a company, the other doesn't. There were more
uses of the latter than the first, leaving very weird code all
over the place.
This commit is contained in:
Patric Stout
2021-04-20 16:26:07 +02:00
committed by Patric Stout
parent 05612d60ae
commit 31897eaa7d
5 changed files with 40 additions and 17 deletions

View File

@@ -203,10 +203,8 @@ int NetworkHTTPSocketHandler::HandleHeader()
*url = '\0';
/* Fetch the hostname, and possible port number. */
const char *company = nullptr;
const char *port = nullptr;
ParseConnectionString(&company, &port, hname);
if (company != nullptr) return_error("[tcp/http] invalid hostname");
ParseConnectionString(&port, hname);
NetworkAddress address(hname, port == nullptr ? 80 : atoi(port));