SolidWallOfCode commented on code in PR #9767:
URL: https://github.com/apache/trafficserver/pull/9767#discussion_r1222067055
##########
iocore/net/YamlSNIConfig.cc:
##########
@@ -178,6 +220,28 @@ template <> struct convert<YamlSNIConfig::Item> {
} else {
return false; // servername must be present
}
+
+ if (node[TS_inbound_port_range]) {
+ swoc::TextView port_view{node[TS_inbound_port_range].Scalar()};
+ auto min{port_view.split_prefix_at('-')};
+ if (!min) {
+ min = port_view;
+ }
+ auto const &max{port_view};
+
+ swoc::TextView parsed_min;
+ long min_port{swoc::svtoi(min, &parsed_min)};
+ swoc::TextView parsed_max;
+ long max_port{swoc::svtoi(max, &parsed_max)};
+ if (parsed_min != min || min_port < 1 || parsed_max != max || max_port >
std::numeric_limits<uint16_t>::max() ||
+ max_port < min_port) {
+ std::string out;
+ swoc::bwprint(out, "bad port range: {}-{}", min, max);
+ throw YAML::ParserException(node[TS_fqdn].Mark(), out);
Review Comment:
Depending on compact you want this, `swoc::bwprint` returns a reference to
the input `std::string` so you coul do
```
throw YAML::ParserException(node[TS_fqdn].Mark(), swoc::bwprint(ts::bw_dbg,
...)));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]