Problem
hostMapping.Matches explicitly supports wildcard sources:
if r.Src == "*" || r.Src == "*:*" {
return true
}
and TestHostMapping_Matches covers them. But parseHostMappings requires a : in the source and requires the source port to parse as an integer, so neither form can ever be constructed from the command line.
Reproduction
$ http-assert --maphost '*=127.0.0.1:8791' --assert-ok http://nope.invalid/ok
Error: Invalid value for --maphost flag: [*=127.0.0.1:8791]
[exit=71]
$ http-assert --maphost '*:*=127.0.0.1:8791' --assert-ok http://nope.invalid/ok
Error: Invalid value for --maphost flag: [*:*=127.0.0.1:8791]
[exit=71]
--maphost '*:80=127.0.0.1:8791' works correctly.
Why it went unnoticed
Tests cover the matcher but not the parser→matcher round trip, so the two halves disagree without failing CI.
Affected code
main.go — parseHostMappings vs hostMapping.Matches
Suggested fix
Decide which behaviour is intended. Either allow * / *:* through the parser, or delete the unreachable branches in Matches and their tests.
Problem
hostMapping.Matchesexplicitly supports wildcard sources:and
TestHostMapping_Matchescovers them. ButparseHostMappingsrequires a:in the source and requires the source port to parse as an integer, so neither form can ever be constructed from the command line.Reproduction
--maphost '*:80=127.0.0.1:8791'works correctly.Why it went unnoticed
Tests cover the matcher but not the parser→matcher round trip, so the two halves disagree without failing CI.
Affected code
main.go—parseHostMappingsvshostMapping.MatchesSuggested fix
Decide which behaviour is intended. Either allow
*/*:*through the parser, or delete the unreachable branches inMatchesand their tests.