Commit 812f12e
committed
perf(client): enable HTTP/2 and brotli support in internal HTTP client
- Prefer HTTP/2 by setting RequestOptions::VERSION => "2.0" so clients
that respect PSR-7 request version will prefer HTTP/2.
- Add a curl hint (CURLOPT_HTTP_VERSION) to prefer HTTP/2 via ALPN
(CURL_HTTP_VERSION_2TLS or CURL_HTTP_VERSION_2_0 fallback) while allowing
automatic fallback to HTTP/1.1.
- Advertise Brotli ("br") in Accept-Encoding when the php-brotli extension
is available (detected via function_exists('brotli_uncompress')), otherwise
fall back to gzip.
Notes:
- The PSR-7 request version is used as a hint for HTTP client libraries;
setting the version to "2.0" signals a preference for HTTP/2 at the request
abstraction level.
- The curl option is defensive: it prefers HTTP/2 where libcurl supports it
(via ALPN), but will not break on older libcurl/builds (uses defined()).
Compatibility:
- Fully backwards compatible: if the php-brotli extension is not present,
no Brotli usage will occur and behaviour remains equivalent to previous
(gzip).
Signed-off-by: ernolf <raphael.gradenwitz@googlemail.com>1 parent 3a687ea commit 812f12e
1 file changed
+16
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
| |||
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
87 | | - | |
88 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
89 | 103 | | |
90 | 104 | | |
91 | 105 | | |
| |||
0 commit comments