Trim space in Endpoint::from_string

Fixes: RIPD-1643
This commit is contained in:
Mike Ellery
2018-06-20 17:18:57 -07:00
committed by Nik Bougalis
parent 68bebc472a
commit 8098cba4c2
3 changed files with 28 additions and 2 deletions

View File

@@ -219,6 +219,11 @@ public:
shouldParseEPV4("1.2.3.4", {{1,2,3,4}}, 0);
shouldParseEPV4("1.2.3.4:5", {{1,2,3,4}}, 5);
shouldParseEPV4("1.2.3.4 5", {{1,2,3,4}}, 5, "1.2.3.4:5");
// leading, trailing space
shouldParseEPV4(" 1.2.3.4:5", {{1,2,3,4}}, 5, "1.2.3.4:5");
shouldParseEPV4("1.2.3.4:5 ", {{1,2,3,4}}, 5, "1.2.3.4:5");
shouldParseEPV4("1.2.3.4 ", {{1,2,3,4}}, 0, "1.2.3.4");
shouldParseEPV4(" 1.2.3.4", {{1,2,3,4}}, 0, "1.2.3.4");
shouldParseEPV6(
"2001:db8:a0b:12f0::1",
{{32, 01, 13, 184, 10, 11, 18, 240, 0, 0, 0, 0, 0, 0, 0, 1}},