Skip to content

Commit

Permalink
fix(net): drop special localhost handling
Browse files Browse the repository at this point in the history
It is unnecessary to special-case the "localhost" domain name, as
documents like RFC 6761 (section 6.3)[1] already define its semantics.
It should hence be simply passed to getaddrinfo(), so that the proper
loopback address is returned.

On the other hand, using "*" as a shorthand for "0.0.0.0" is not
universally accepted, so Pistache should continue handle it specifically
for backwards compatibility.

This restores getaddrinfo() coverage regressed by commit
50e39e1.

[1]: https://www.rfc-editor.org/rfc/rfc6761.html#section-6.3
  • Loading branch information
Tachi107 committed Jun 27, 2023
1 parent e884d6d commit 363629b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions src/common/net.cc
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,6 @@ namespace Pistache
{
host = "0.0.0.0";
}
else if (host == "localhost")
{
host = "127.0.0.1";
}

const auto& addresses = HostToIPv4(host, portPart);
if (!addresses.empty())
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.1.20230324
0.1.1.20230627

0 comments on commit 363629b

Please sign in to comment.