8000 [HttpClient] force HTTP/1.1 when NTLM auth is used · symfony/symfony@0e87e9b · GitHub
[go: up one dir, main page]

Skip to content

Commit 0e87e9b

Browse files
[HttpClient] force HTTP/1.1 when NTLM auth is used
1 parent 4e44baf commit 0e87e9b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/Symfony/Component/HttpClient/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_ntl 9A1E m'])) {
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)
0