Add non-HttpSM tests for acquireSession - #13579
Conversation
This patch includes a few simple test cases for `acquireSession`. They cover only the behavior which does not require an `HttpSM` object.
There was a problem hiding this comment.
Pull request overview
Adds Catch2 unit coverage for ServerSessionPool::acquireSession() paths that do not require an HttpSM instance, and updates the public header documentation to better describe the API’s selection behavior.
Changes:
- Add a new
test_HttpSessionManager.ccexercisingacquireSession()matching behavior for IP-only, host-only, and combined masks. - Wire the new unit test file into the
test_httptarget. - Expand / clarify
ServerSessionPool::acquireSession()documentation inHttpSessionManager.h.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/proxy/http/unit_tests/test_HttpSessionManager.cc | New Catch2 unit tests for ServerSessionPool::acquireSession() without HttpSM. |
| src/proxy/http/unit_tests/CMakeLists.txt | Adds the new test source to the test_http executable. |
| include/proxy/http/HttpSessionManager.h | Updates the doxygen comment for acquireSession() to clarify behavior and constraints. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (2)
include/proxy/http/HttpSessionManager.h:104
- The
smparameter docs currently say it is only consulted for SNI/certificate validation when the corresponding bits are set inmatch_style, butacquireSession()also callsvalidate_session_origin_cert(sm, ...)unconditionally. For multiplexing sessions this dereferencessmfor origin certificate hostname verification regardless ofmatch_style, so the docs should reflect that broader usage (or explicitly statesmmust be non-null when multiplexing sessions may be present).
* @param[in] sm The requesting HTTP state machine; consulted for SNI and certificate
* validation when the corresponding bits are set in @p match_style.
src/proxy/http/unit_tests/test_HttpSessionManager.cc:209
- In this section,
acquiredis set by a successfulDONEacquisition and then reused in aNOT_FOUNDacquisition, but the test doesn't assert thatacquireSession()clears the output parameter on failure. Adding aCHECK(acquired == nullptr)here would verify the documented out-parameter contract for the non-null -> null transition.
CHECK(acquired == session);
// A non-multiplexing session is handed off, not shared: it leaves both pools.
CHECK(pool.count() == 0);
CHECK(pool.acquireSession(Addr{"10.0.0.1:80"}, hash_of("one.example.com"), MATCH_HOSTONLY, nullptr, acquired) ==
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
include/proxy/http/HttpSessionManager.h:104
- The
smparameter docs say it is only consulted when the corresponding bits are set inmatch_style, butacquireSession()always callsvalidate_session_origin_cert(sm, session)(seesrc/proxy/http/HttpSessionManager.cc:176-239). For multiplexing sessions that function dereferencessm(sm->get_outbound_sni_for_cert_verification(),HttpSessionManager.cc:50-53) even ifmatch_styledoesn’t includeTS_SERVER_SESSION_SHARING_MATCH_MASK_CERT. Please update the parameter documentation to reflect thatsmmay be consulted when evaluating multiplexed sessions (origin-certificate hostname validation), so callers knowsmmust be valid in that case.
* @param[in] sm The requesting HTTP state machine; consulted for SNI and certificate
* validation when the corresponding bits are set in @p match_style.
|
[approve ci autest 3] |
Reset metric after each subcase Improve `sm` parameter doc
This patch includes a few simple test cases for
acquireSession. They cover only the behavior which does not require anHttpSMobject.