diff --git a/include/proxy/http3/Http3Transaction.h b/include/proxy/http3/Http3Transaction.h index abb7dfd6359..d911967ff17 100644 --- a/include/proxy/http3/Http3Transaction.h +++ b/include/proxy/http3/Http3Transaction.h @@ -74,6 +74,17 @@ class HQTransaction : public ProxyTransaction virtual int state_stream_closed(int event, Event *data) = 0; NetVConnectionContext_t direction() const; + /** Full-width QUIC stream identifier for this transaction. + * + * @c get_transaction_id returns @c int and exists primarily for compact log + * fields and probe arguments; QUIC stream IDs are 62-bit values, so callers + * that route or compare by stream ID must use this accessor to avoid + * truncation. + * + * @return The QUIC stream ID owned by this transaction. + */ + QUICStreamId get_quic_stream_id() const; + // For Queue from tscore/Link.h LINK(HQTransaction, link); diff --git a/src/proxy/http3/Http3Session.cc b/src/proxy/http3/Http3Session.cc index 4c899f2e37f..1ec5a09d161 100644 --- a/src/proxy/http3/Http3Session.cc +++ b/src/proxy/http3/Http3Session.cc @@ -97,7 +97,7 @@ HQTransaction * HQSession::get_transaction(QUICStreamId id) { for (HQTransaction *t = this->_transaction_list.head; t; t = static_cast(t->link.next)) { - if (t->get_transaction_id() == static_cast(id)) { + if (t->get_quic_stream_id() == id) { return t; } } diff --git a/src/proxy/http3/Http3Transaction.cc b/src/proxy/http3/Http3Transaction.cc index 44b2c828ef7..b2a818029f8 100644 --- a/src/proxy/http3/Http3Transaction.cc +++ b/src/proxy/http3/Http3Transaction.cc @@ -225,6 +225,13 @@ HQTransaction::transaction_done() int HQTransaction::get_transaction_id() const +{ + // Narrowing is intentional here; see get_quic_stream_id() for the full-width value. + return static_cast(this->_stream_id); +} + +QUICStreamId +HQTransaction::get_quic_stream_id() const { return this->_stream_id; }