Skip to content

Commit f0689ea

Browse files
Merge branch '4.4' into 5.0
* 4.4: [travis] fix CI (ter) Revert "[travis][appveyor] don't cache .phpunit" silence E_NOTICE triggered since PHP 7.4 [Form] Removed legacy check in `ValidationListener` [HttpClient] fix HTTP/2 support on non-SSL connections - CurlHttpClient only Force ping after transport Exception do not merge constraints within interfaces [Validator] Fixed default group for nested composite constraints
2 parents 14d386a + c571fa9 commit f0689ea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

CurlHttpClient.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ public function request(string $method, string $url, array $options = []): Respo
141141
CURLOPT_CERTINFO => $options['capture_peer_cert_chain'],
142142
];
143143

144-
if (1.0 === (float) $options['http_version']) {
144+
if (\defined('CURL_VERSION_HTTP2') && (CURL_VERSION_HTTP2 & self::$curlVersion['features']) && ('https:' === $scheme || 2.0 === (float) $options['http_version'])) {
145+
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
146+
} elseif (1.0 === (float) $options['http_version']) {
145147
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0;
146-
} elseif (1.1 === (float) $options['http_version'] || 'https:' !== $scheme) {
148+
} elseif (1.1 === (float) $options['http_version']) {
147149
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
148-
} elseif (\defined('CURL_VERSION_HTTP2') && CURL_VERSION_HTTP2 & self::$curlVersion['features']) {
149-
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
150150
}
151151

152152
if (isset($options['auth_ntlm'])) {

0 commit comments

Comments
 (0)