feat(auth): integrate HttpClient with auth providers, expand tests, fix CMake deprecation - #29
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 2 follow-up to the OAuth2/PKCE auth module:
set_auth_provider()automatically callsIAuthProvider::authorize()on every request created by the client before submission.validate_statetests (empty, matching, mismatching).invalid_granterror response.CMP0169(FetchContent_Populatedeprecation) for CMake 3.30+ so fallback dependency downloads stay warning-free.ci.yml(added in previous PR); examples verified to compile cleanly.Test plan
tests/auth/suite passes (5/5)KURLYK_OAUTH_SUPPORT=OFF🤖 Generated with Claude Code