Skip to content

Commit

Permalink
Exit when agent encounters malformed url in configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
wsobel committed Oct 3, 2024
1 parent 7c9e87c commit a269ca7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/mtconnect/configuration/agent_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,15 @@ namespace mtconnect::configuration {

auto parsed = Url::parse(url);
options[configuration::Protocol] = parsed.m_protocol;
options[configuration::Host] = parsed.getHost();

auto host = parsed.getHost();
if (host.empty())
{
LOG(fatal) << "Malformed URL in configuration file: '" << url << "', exiting";
exit(1);
}
options[configuration::Host] = host;

if (parsed.m_port)
options[configuration::Port] = parsed.getPort();
if (parsed.m_path != "/")
Expand Down

0 comments on commit a269ca7

Please sign in to comment.