Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0e87e9b

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

File tree

1 file changed

+9
-8
lines changed
Filter options

1 file changed

+9
-8
lines changed

‎src/Symfony/Component/HttpClient/CurlHttpClient.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/CurlHttpClient.php
+9-8Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.