Skip to content

Implement native HttpClient CurlAdapter for single requests #566

Description

@armanist

Parent

Part of #565.

Summary

Replace the vendor-backed Quantum\HttpClient\Adapters\CurlAdapter internals with a native curl implementation for single requests while preserving the existing HttpClient facade behavior and CurlAdapterInterface contract.

Scope

  • Implement native single-request curl execution behind CurlAdapter.
  • Preserve current public HttpClient methods and behavior:
    • createRequest()
    • setMethod()
    • setData()
    • setHeader() / setHeaders()
    • setOpt() / setOpts()
    • start()
    • getResponseBody()
    • getResponseHeaders()
    • getResponseCookies()
    • getErrors()
    • info()
    • url()
  • Preserve factory/helper usage:
    • HttpClientFactory::createRequest($url)
    • httpRequest($url)
  • Keep compatibility constructor path if still needed for transition tests, but do not expose native handles as the preferred public API.

Behavior To Match

  • Request method handling via CURLOPT_CUSTOMREQUEST.
  • Request body handling through existing setData() behavior.
  • Header and option forwarding.
  • Response body extraction.
  • Response header normalization used by HttpClient.
  • Cookie extraction shape expected by existing tests.
  • Error code/message behavior.
  • getInfo() behavior, including option value 0.
  • URL reporting through url().

Acceptance Criteria

  • CurlAdapter no longer depends on Curl\Curl for normal execution.
  • Existing single-request HttpClient behavior remains compatible.
  • Focused unit tests cover native curl success, error, headers, cookies, info, URL, options, and payload behavior.
  • Downstream remote image download smoke test passes through httpRequest().
  • php-curl-class/php-curl-class remains installed until the multi-curl child ticket is complete.

Out Of Scope

  • Native multi-curl implementation.
  • Removing php-curl-class/php-curl-class from Composer.
  • Changing the public HttpClient facade API.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthttpHTTP transport, redirects, and request/response behavior

Fields

No fields configured for Feature.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions