ref(transport): unify and restructure HTTP transport layer#1514
Draft
ref(transport): unify and restructure HTTP transport layer#1514
Conversation
Collaborator
Author
|
@sentry review |
Collaborator
Author
|
@cursor review |
Collaborator
Author
|
@sentry review |
Collaborator
Author
|
@cursor review |
Introduce sentry_http_transport as a shared base for curl and WinHTTP transports. This centralizes bgworker management (start, flush, shutdown, send_envelope, dump) so each backend only provides state, start, and send_task. WinHTTP's force-close-on-timeout behavior is supported via an optional shutdown_hook parameter. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move fields duplicated across curl and WinHTTP backends into the shared http_transport_state_t. The shared http_send_task() now calls sentry__prepare_http_request() and passes the prepared request to backend send functions via a new sentry_http_send_func_t callback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Avoid ambiguity with sentry_backend_t by renaming backend_state, free_backend_state, start_backend, and platform-specific types/functions (curl_state_t, winhttp_state_t, etc.) to use "client" terminology. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add sentry__transport_get_state as a generic internal accessor and move the HTTP-specific bgworker helper to sentry__http_transport_get_bgworker. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the monolithic constructor with individual setters, mirroring the public transport API. Rename shutdown_hook to shutdown_client for consistency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…names
Rename sentry_transport_{curl,winhttp}.c to sentry_http_transport_{curl,winhttp}.c
to group with the base sentry_http_transport. Normalize local function names to
consistent {prefix}_client_{verb} pattern.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduce sentry_http_response_t so clients just populate response metadata (status_code, retry_after, x_sentry_rate_limits) and the abstract transport handles rate limiting in one place. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…sport Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
curl_easy_getinfo writes a long* and WinHttpQueryHeaders writes a DWORD. Use local variables of the correct native type and assign to the int status_code field to avoid type-size mismatches. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The curl header_callback may populate retry_after/x_sentry_rate_limits before curl_easy_perform fails. Moving the frees outside the success branch avoids leaking these strings on network errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…port If sentry__http_transport_new returns NULL, the subsequent set_* calls would dereference a null pointer. Free the client and return NULL early. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
13ed185 to
3a74190
Compare
jpnurmi
added a commit
that referenced
this pull request
Feb 13, 2026
3 tasks
jpnurmi
added a commit
that referenced
this pull request
Feb 13, 2026
jpnurmi
added a commit
that referenced
this pull request
Feb 13, 2026
jpnurmi
added a commit
that referenced
this pull request
Feb 16, 2026
jpnurmi
added a commit
that referenced
this pull request
Feb 16, 2026
jpnurmi
added a commit
that referenced
this pull request
Feb 16, 2026
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
sentry_http_transport.c/.h) from the curl and WinHTTP transports, eliminating duplicated logic for background workers, rate limiting, request preparation, and envelope lifecycle managementsentry_transport.c/.h) into the HTTP transport layer, keeping the generic transport truly transport-agnosticsentry_http_send_func_tcallback interfaceTest plan
test_integration_http/ratelimits/proxy.py)