Skip to content

Commit 4c052cb

Browse files
Merge branch '4.4' into 5.0
* 4.4: [DI] Service locators can't be decorated [HttpClient] force HTTP/1.1 when NTLM auth is used [Validation][FrameworkBundle] Allow EnableAutoMapping to work without auto-mapping namespaces [Console][SymfonyQuestionHelper] Handle multibytes question choices keys and custom prompt [DI] fix auto-binding service providers to their service subscribers [Mailer] fixed undefined index when sending mail
2 parents ee432c2 + c7c05b1 commit 4c052cb

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

CurlHttpClient.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,17 @@ public function request(string $method, string $url, array $options = []): Respo
158158
CURLOPT_CERTINFO => $options['capture_peer_cert_chain'],
159159
];
160160

161+
if (1.0 === (float) $options['http_version']) {
162+
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0;
163+
} elseif (1.1 === (float) $options['http_version'] || 'https:' !== $scheme) {
164+
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
165+
} elseif (\defined('CURL_VERSION_HTTP2') && CURL_VERSION_HTTP2 & self::$curlVersion['features']) {
166+
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
167+
}
168+
161169
if (isset($options['auth_ntlm'])) {
162170
$curlopts[CURLOPT_HTTPAUTH] = CURLAUTH_NTLM;
171+
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
163172

164173
if (\is_array($options['auth_ntlm'])) {
165174
$count = \count($options['auth_ntlm']);
@@ -212,14 +221,6 @@ public function request(string $method, string $url, array $options = []): Respo
212221
$curlopts[CURLOPT_RESOLVE] = $resolve;
213222
}
214223

215-
if (1.0 === (float) $options['http_version']) {
216-
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0;
217-
} elseif (1.1 === (float) $options['http_version'] || 'https:' !== $scheme) {
218-
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
219-
} elseif (\defined('CURL_VERSION_HTTP2') && CURL_VERSION_HTTP2 & self::$curlVersion['features']) {
220-
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
221-
}
222-
223224
if ('POST' === $method) {
224225
// Use CURLOPT_POST to have browser-like POST-to-GET redirects for 301, 302 and 303
225226
$curlopts[CURLOPT_POST] = true;

0 commit comments

Comments
 (0)