Skip to content

Implement native HttpClient MultiCurlAdapter for multi requests #567

Description

@armanist

Parent

Part of #565.

Summary

Replace the vendor-backed Quantum\HttpClient\Adapters\MultiCurlAdapter internals with a native multi-curl implementation while preserving existing multi-request and async callback behavior.

This ticket should be handled separately from the single-request adapter because multi-curl behavior is more complex and carries higher regression risk.

Scope

  • Implement native multi-curl execution behind MultiCurlAdapter.
  • Preserve current public HttpClient multi-request behavior:
    • createMultiRequest()
    • createAsyncMultiRequest()
    • addGet()
    • addPost()
    • setHeader() / setHeaders()
    • setOpt() / setOpts()
    • start()
    • getResponse()
    • getErrors()
    • isMultiRequest() guard behavior
  • Preserve factory/helper usage:
    • HttpClientFactory::createMultiRequest()
    • HttpClientFactory::createAsyncMultiRequest($success, $error)
    • httpMultiRequest()
    • httpAsyncMultiRequest($success, $error)

Behavior To Match

  • Queueing multiple GET and POST requests.
  • Returning Quantum CurlAdapter instances from addGet() and addPost() where current adapter behavior does so.
  • Complete callback registration and invocation.
  • Success callback registration and invocation.
  • Error callback registration and invocation.
  • Response aggregation by request ID.
  • Error aggregation by request ID.
  • Request ID stability for queued requests.
  • Header and option propagation to queued requests.
  • Response headers, cookies, and body shape expected by HttpClient.
  • Async callback behavior without leaking raw vendor/native handles across the adapter boundary.

Acceptance Criteria

  • MultiCurlAdapter no longer depends on Curl\MultiCurl for normal execution.
  • Existing multi-request and async HttpClient tests pass.
  • Focused tests cover queueing, callbacks, success/error behavior, response aggregation, and option/header propagation.
  • Downstream or local smoke coverage confirms multi-request execution where practical.
  • After this ticket and the single-request native adapter ticket are complete, evaluate and remove php-curl-class/php-curl-class from Composer if no compatibility bridge remains.

Out Of Scope

  • Changing the public HttpClient facade API.
  • Reworking the factory/helper API.
  • Removing php-curl-class/php-curl-class before single and multi native adapter parity is complete.

Metadata

Metadata

Assignees

No one assigned

    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