From 28f0977e0bf439e5acfd1c6694b17242c474e959 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 23 Sep 2026 14:40:20 +0200 Subject: [PATCH] ref(transport)!: rename and document custom transport factory The factory used a private-style `sentry__`-prefixed name even though custom transports must provide its implementation. Give it a public-style name and document the contract for custom implementations. BREAKING CHANGE: Custom transport implementations must define: ``` sentry_transport_t *sentry_transport_new_default(void) ``` --- README.md | 5 +++++ src/sentry_options.c | 2 +- src/sentry_transport.h | 2 +- src/transports/sentry_http_transport_curl.c | 2 +- src/transports/sentry_http_transport_winhttp.c | 2 +- src/transports/sentry_transport_none.c | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3673c3eae8..798b60c8a9 100644 --- a/README.md +++ b/README.md @@ -251,6 +251,11 @@ using `cmake -D BUILD_SHARED_LIBS=OFF ..`. Windows and is the default there. - **none**: Do not build any HTTP transport. This should be used if users want to handle uploads themselves + - **custom**: Provide an external + `sentry_transport_t *sentry_transport_new_default(void)` implementation + (with `extern "C"` linkage if written in C++). Return a transport created + with `sentry_transport_new` or `sentry_http_transport_new`, or `NULL` to + disable uploads. - `SENTRY_SCREENSHOT` (Default: `windows` on Windows, `none` elsewhere): Selects the screenshot implementation. Set it to `custom` and provide an diff --git a/src/sentry_options.c b/src/sentry_options.c index 6504cf5d42..54c01d0512 100644 --- a/src/sentry_options.c +++ b/src/sentry_options.c @@ -107,7 +107,7 @@ sentry_options_new(void) false; #endif opts->backend = sentry__backend_new(); - opts->transport = sentry__transport_new_default(); + opts->transport = sentry_transport_new_default(); opts->refcount = 1; opts->shutdown_timeout = SENTRY_DEFAULT_SHUTDOWN_TIMEOUT; opts->transfer_timeout = SENTRY_DEFAULT_TRANSFER_TIMEOUT; diff --git a/src/sentry_transport.h b/src/sentry_transport.h index 4c4dd0ef01..afe7fdb463 100644 --- a/src/sentry_transport.h +++ b/src/sentry_transport.h @@ -46,7 +46,7 @@ int sentry__transport_shutdown(sentry_transport_t *transport, uint64_t timeout); /** * This will create a new platform specific HTTP transport. */ -sentry_transport_t *sentry__transport_new_default(void); +sentry_transport_t *sentry_transport_new_default(void); /** * This function will instruct the platform specific transport to dump all the diff --git a/src/transports/sentry_http_transport_curl.c b/src/transports/sentry_http_transport_curl.c index 32296facb8..79c0846751 100644 --- a/src/transports/sentry_http_transport_curl.c +++ b/src/transports/sentry_http_transport_curl.c @@ -547,7 +547,7 @@ curl_send_task(void *_client, sentry_prepared_http_request_t *req, } sentry_transport_t * -sentry__transport_new_default(void) +sentry_transport_new_default(void) { SENTRY_INFO("initializing curl transport"); curl_client_t *client = curl_client_new(); diff --git a/src/transports/sentry_http_transport_winhttp.c b/src/transports/sentry_http_transport_winhttp.c index cc9db472d2..63a5ed6a68 100644 --- a/src/transports/sentry_http_transport_winhttp.c +++ b/src/transports/sentry_http_transport_winhttp.c @@ -410,7 +410,7 @@ exit:; } sentry_transport_t * -sentry__transport_new_default(void) +sentry_transport_new_default(void) { SENTRY_INFO("initializing winhttp transport"); winhttp_client_t *client = winhttp_client_new(); diff --git a/src/transports/sentry_transport_none.c b/src/transports/sentry_transport_none.c index 361a947e76..e9553e4cda 100644 --- a/src/transports/sentry_transport_none.c +++ b/src/transports/sentry_transport_none.c @@ -2,7 +2,7 @@ #include "sentry_transport.h" sentry_transport_t * -sentry__transport_new_default(void) +sentry_transport_new_default(void) { return NULL; }