moonchen commented on code in PR #13516:
URL: https://github.com/apache/trafficserver/pull/13516#discussion_r3770109188
##########
src/iocore/net/ConnectionTracker.cc:
##########
@@ -49,11 +51,9 @@ const MgmtConverter ConnectionTracker::MIN_SERVER_CONV(
const MgmtConverter ConnectionTracker::SERVER_MATCH_CONV{
[](const void *data) -> MgmtInt { return
static_cast<MgmtInt>(*static_cast<const decltype(TxnConfig::server_match)
*>(data)); },
[](void *data, MgmtInt i) -> void {
- // Problem - the InkAPITest requires being able to set an arbitrary value,
so this can either
- // correctly clamp or pass the regression tests. Currently it passes the
tests.
- // *static_cast<decltype(TxnConfig::match) *>(data) =
std::clamp(static_cast<decltype(TxnConfig::match)>(i), MATCH_IP,
- // MATCH_BOTH);
- *static_cast<decltype(TxnConfig::server_match) *>(data) =
static_cast<decltype(TxnConfig::server_match)>(i);
+ auto const value = std::clamp(i, static_cast<MgmtInt>(MATCH_IP),
static_cast<MgmtInt>(MATCH_BOTH));
Review Comment:
The string setter below rejects an unknown tag and calls
`Warning_Bad_Match_Type()`, leaving the value alone. Here an out-of-range int
is silently coerced and `TSHttpTxnConfigIntSet()` still returns `TS_SUCCESS`,
so `match: 95` quietly becomes `both` while `match: "bogus"` warns. Intentional?
--
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]