Skip to content

feat(auth): integrate HttpClient with auth providers, expand tests, fix CMake deprecation - #29

Merged
LimiNode merged 4 commits into
mainfrom
feat/auth-integration-and-ci
May 23, 2026
Merged

feat(auth): integrate HttpClient with auth providers, expand tests, fix CMake deprecation#29
LimiNode merged 4 commits into
mainfrom
feat/auth-integration-and-ci

Conversation

@LimiNode

Copy link
Copy Markdown
Owner

Summary

Phase 2 follow-up to the OAuth2/PKCE auth module:

  • HttpClient auth integration: set_auth_provider() automatically calls IAuthProvider::authorize() on every request created by the client before submission.
  • Expanded auth tests:
    • Empty Bearer token and empty ApiKey name/value edge cases.
    • OAuth validate_state tests (empty, matching, mismatching).
    • Custom parser simulating invalid_grant error response.
  • CMake deprecation fix: Suppressed CMP0169 (FetchContent_Populate deprecation) for CMake 3.30+ so fallback dependency downloads stay warning-free.
  • CI: Auth tests job already present in ci.yml (added in previous PR); examples verified to compile cleanly.

Test plan

  • tests/auth/ suite passes (5/5)
  • All examples compile with MinGW
  • C++11 header smoke test compiles and runs
  • Bearer-only example builds with KURLYK_OAUTH_SUPPORT=OFF

🤖 Generated with Claude Code

LimiNode and others added 4 commits May 23, 2026 14:39
…ix CMake deprecation

- Add HttpClient::set_auth_provider() to auto-authorize every request
- Expand auth provider tests with empty token/key edge cases
- Expand OAuth tests with validate_state and custom-parser error cases
- Suppress CMP0169 FetchContent_Populate deprecation in CMake 3.30+

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ling

wait_requests_by_group_id() could return immediately if
group_request_count_unlocked() was zero between moving requests out of
m_pending_requests and pushing the batch into m_active_request_batches.
This caused the test to proceed before the callback fired, or the callback
to be dropped entirely if curl_easy_init failed silently.

- HttpBatchRequestHandler: fail all contexts immediately when
curl_multi_init() or curl_easy_init() returns nullptr, instead of
silently dropping the request context.
- HttpRequestManager::process_pending_requests(): wrap batch creation
in try/catch and fail all pending contexts on exception instead of
silently losing them.
- HttpRequestManager::wait_requests_by_group_id(): remove the
"invoke_now" fast path; always register the waiter callback so it is
delivered by notify_group_waiters_if_idle() after the next process()
loop, closing the pending-to-active staging window.
- http_client_wait_requests_test: add diagnostic prints for ok,
in_flight and callback_count to make future CI failures observable.

Directive: Always defer waiter callback to notify_group_waiters_if_idle()
to avoid the pending-to-active staging race.
Directive: Fail pending contexts immediately if HttpBatchRequestHandler
or curl_multi_init() throws, instead of silently dropping them.
Scope-risk: moderate (core request manager paths touched)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Wrap auth examples in if(KURLYK_AUTH_SUPPORT) in examples/CMakeLists.txt
- Add integration test for HttpClient::set_auth_provider() injection behavior
- Document that provider overwrites per-request Authorization headers
- Document thread-safety contract for set_auth_provider()

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Remove double lock.unlock() in process_pending_requests() catch block.
- Restore immediate callback in wait_requests_by_group_id() for empty
  groups while keeping race-safe pattern (decide under lock, invoke outside).
- Remove diagnostic cerr from http_client_wait_requests_main.cpp.
- Guard curl_multi_cleanup with if(m_multi_handle) in destructor.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@LimiNode
LimiNode merged commit 2ae78ba into main May 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant