Repository navigation
Remove curl usages - #108296
Remove curl usages#108296
curl usages#108296Conversation
The HTTP transport of `google_cloud_cpp_rest_internal` is now implemented on `Poco::Net` (`contrib/google-cloud-cpp-cmake/poco_rest_client.cc`), replacing the libcurl-based one. The libcurl implementation sources are excluded from the build and `CURL::libcurl` is no longer linked; curl headers remain include-only for declarations referenced by legacy `storage::oauth2` template default parameters that are never instantiated. The submodule is updated to replace `CurlHandle::MakeEscapedString` in signed URL canonicalization with a curl-free strict RFC 3986 encoder matching `curl_easy_escape` semantics. An empty header value means "do not send the header", matching the libcurl transport where an empty value unsets a header: the storage stub relies on this to disable chunked transfer encoding, and a literal empty `Transfer-Encoding` header makes servers ignore `Content-Length`. Verified end-to-end against fake-gcs-server: resumable upload, metadata parsing, and streaming download work through the new transport, and the resulting libraries contain no references to curl symbols. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
|
Supersedes #108254 |
|
Workflow [PR], commit [49061c5] Summary: ❌
AI ReviewSummaryThis PR removes the vendored Findings
Tests
Final VerdictStatus: Minimum required actions: preserve or explicitly reject HTTPS proxy semantics for GCS REST, and either restore pooled GCS connections or make the |
| if (options.has<ProxyOption>()) { | ||
| auto const& proxy = options.get<ProxyOption>(); | ||
| if (!proxy.hostname().empty()) { | ||
| Poco::UInt16 port = Poco::Net::HTTPSession::HTTP_PORT; |
There was a problem hiding this comment.
ProxyConfig includes a scheme and defaults it to https, and the old curl path passed the full scheme://host[:port] proxy URL. This replacement ignores proxy.scheme() and defaults an empty port to HTTP_PORT, so ProxyConfig().set_hostname("proxy") changes from an HTTPS proxy to port 80 with no proxy TLS.
Please preserve the configured proxy scheme/default port semantics, or reject unsupported proxy schemes explicitly instead of silently connecting to a different proxy endpoint.
| // alive until the payload is consumed. | ||
| std::unique_ptr<RestClient> MakePooledRestClient(std::string endpoint_address, | ||
| Options options) { | ||
| return MakeDefaultRestClient(std::move(endpoint_address), |
There was a problem hiding this comment.
MakePooledRestClient is the path used by the GCS REST stub, and ConnectionPoolSizeOption is a documented storage client option. Returning the unpooled client here makes that option ineffective and forces every GCS request to create a fresh TCP/TLS session, which is a real throughput/latency regression for repeated object reads, uploads, and metadata operations.
Please either preserve pooling with a Poco-backed pool (for example using the existing ClickHouse HTTP connection pool) or remove/reject the pooling option for this transport with a clear migration story.
…s set Address review feedback on the Poco-based replacement for librdkafka's libcurl HTTP transport: when `https.ca.location` or `https.ca.pem` is configured, trust only those roots instead of also loading the system trust store. The libcurl-based transport replaced the default trust roots rather than extending them, so loading defaults here weakened certificate-pinning/custom-CA semantics for the OIDC token endpoint (`sasl.oauthbearer.token.endpoint.url`). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Address review feedback on the Poco-based replacement for the libcurl-based `RestClient` transport, making it faithful to the original `CurlRestClient`: - Merge `context.options()` with the client options at the start of every request, so per-call options carried by an `OptionsSpan` (stall timeout, CA bundle, proxy, etc.) are honored throughout building the URL, session and headers. - Apply `UnifiedCredentialsOption`: map it to an OAuth 2.0 credential in the constructor and add the resulting authentication header to each request. External-account and impersonated service-account credentials build their token-fetching clients via `MakeDefaultRestClient` and were previously sent unauthenticated. - Honor `CurlFollowLocationOption` (defaults to false and is unset in ClickHouse) instead of always following redirects, and resolve relative `Location` values against the current URL so a `Location: /path` redirect keeps the scheme and host. - When an explicit CA bundle is configured via `CARootsFilePathOption`, do not also load the system trust store, preserving custom-CA/pinning semantics. - Default a payload's `Content-Type` to `application/x-www-form-urlencoded` and percent-encode the body to match the libcurl transport; the `form_data` `Post` overload marks its own `Content-Type` so its already-encoded body is not encoded twice. - Default the proxy port from the configured `ProxyConfig` scheme (443 for `https`) instead of always assuming the plain-HTTP port. - Document that `ConnectionPoolSizeOption` is intentionally ignored because `Poco::Net::HTTPClientSession` is not thread-safe. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
| return result; | ||
| } | ||
|
|
||
| std::chrono::seconds RequestTimeout(Options const& options) { |
There was a problem hiding this comment.
TransferStallTimeoutOption and DownloadStallTimeoutOption are not plain socket timeouts in the curl transport: curl applies the download timeout to GET, the transfer timeout to uploads/other requests, and aborts when the transfer rate stays below the configured minimum rate for that many seconds. This helper collapses both options into one Poco send/receive timeout, ignores TransferStallMinimumRateOption/DownloadStallMinimumRateOption, and starts from 120s, so a client setting DownloadStallTimeoutOption{5s} still waits 120s for a stalled GET.
Please preserve the method-specific stall contract (including the minimum-rate checks while streaming), or reject unsupported non-default stall-rate options instead of silently making configured GCS read/write stall detection ineffective.
|
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 10/10 (100.00%) | Lost baseline coverage: none · Uncovered code |
The pinned pulsar-client-cpp revision predates several changes in the ClickHouse third-party stack, so the contrib CMake file now provides compatibility layers instead of requiring changes inside the submodule: - ClickHouse removed the `curl` submodule (PR ClickHouse#108296), so a minimal stub of the libcurl API is provided in `curl-stub/`. The Pulsar binary protocol (`pulsar://`) is fully functional; HTTP topic lookup (`http://` service URLs) and OAuth2 authentication fail at runtime with a clear error. `curl_easy_escape` (used by `TopicName` percent-encoding) is implemented for real. - Boost was updated to 1.90, which removed the deprecated Asio APIs the client uses (`io_service`, `const_buffers_1`/`mutable_buffers_1`, `resolver::query`/`iterator`, `expires_from_now`, `cancel(error_code &)`, `rfc2818_verification`). Shim headers in `asio-compat/` restore them on top of the modern API. - The vendored protobuf returns `absl::string_view` from descriptor accessors, so `ProtobufNativeSchema.cc` is compiled from a patched copy in `patched/`. - The protobuf codegen and `Version.h` are now generated into the binary directory (the previous version wrote into the submodule working tree and relied on a `LIBARARY_DIR` typo that excluded the generated sources from the first configure). Co-Authored-By: Claude Fable 5 <[email protected]>
Remove `curl` usages
Backport of ClickHouse#114301 (which targeted 25.8) to 26.6. `curl` is still bundled in 26.6: the removal in ClickHouse#108296 landed after the 26.6 branch was cut, so it only shipped in 26.7. Fixes 10 CVEs from the curl 8.21.0 security disclosure that apply to our build (connection reuse, cookie handling, proxy and Digest auth, mTLS config matching, WebSocket auto-PONG memory exhaustion). Adapted for 26.6's reduced source list (see "Disable unused curl features"): `lib/noproxy.c` was removed upstream, its logic moved into the new `lib/proxy.c`; also added the new unconditional core files `lib/cf-recvbuf.c`, `lib/cf-setup.c`, `lib/creds.c`, `lib/peer.c`, and `lib/vtls/vtls_config.c`. Verified: every file in the source list compiles, and the resulting objects have no unresolved internal `Curl_`/`curlx_` symbols. Co-Authored-By: chethan-64 <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Remove usages of
curllibrary across codebase and contribs.Version info
26.6.1.1191