Skip to content

Add HTTP/3 protocol mapping to curl adapter - #19546

Open
masakielastic wants to merge 1 commit into
cakephp:5.xfrom
masakielastic:feature/http-client-http3
Open

Add HTTP/3 protocol mapping to curl adapter#19546
masakielastic wants to merge 1 commit into
cakephp:5.xfrom
masakielastic:feature/http-client-http3

Conversation

@masakielastic

Copy link
Copy Markdown

Summary

Add support for mapping PSR-7 HTTP protocol versions 3 and 3.0 to CURL_HTTP_VERSION_3 in the curl HTTP client adapter.

The adapter now throws an HttpException with a descriptive message when the required curl constant is not available.

Changes

  • Map protocol versions 3 and 3.0 to CURL_HTTP_VERSION_3
  • Preserve the existing fallback behavior for unsupported or unspecified protocol versions
  • Add test coverage for the HTTP/3 protocol mapping

Testing

The HTTP/3 adapter test passes locally with PHP 8.6.0-dev and an HTTP/3-enabled curl build:

../php-src/sapi/cli/php -d zend.assertions=1 \
    vendor/bin/phpunit \
    tests/TestCase/Http/Client/Adapter/CurlTest.php

Notes

This change covers protocol-version mapping in the curl adapter. It does not perform a live HTTP/3 integration test.

CakePHP's default Request implementation currently relies on Laminas Diactoros, which rejects protocol version 3 in withProtocolVersion(). The test therefore uses a partial mock that returns 3 from getProtocolVersion().

A full test-suite run with PHP 8.6.0-dev also reports an unrelated failure in:

Cake\Test\TestCase\View\Helper\TimeHelperTest::testTimeAgoInWordsOutputTimezone

No date, time, view helper, or internationalization files are changed by this pull request.

Map PSR-7 HTTP protocol versions 3 and 3.0 to CURL_HTTP_VERSION_3 and add test coverage.
@masakielastic

Copy link
Copy Markdown
Author

CakePHP's default PSR-7 request implementation relies on laminas/laminas-diactoros.

The current Diactoros protocol-version validation rejects 3 and 3.0 before the request reaches the curl adapter. I opened an upstream pull request to add HTTP/3 protocol-version support:

laminas/laminas-diactoros#230

@dereuromark dereuromark added this to the 5.4.0 milestone Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants