@@ -158,8 +158,17 @@ public function request(string $method, string $url, array $options = []): Respo
158
158
CURLOPT_CERTINFO => $ options ['capture_peer_cert_chain ' ],
159
159
];
160
160
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
+
161
169
if (isset ($ options ['auth_ntlm ' ])) {
162
170
$ curlopts [CURLOPT_HTTPAUTH ] = CURLAUTH_NTLM ;
171
+ $ curlopts [CURLOPT_HTTP_VERSION ] = CURL_HTTP_VERSION_1_1 ;
163
172
164
173
if (\is_array ($ options ['auth_ntl
9A1E
m ' ])) {
165
174
$ count = \count ($ options ['auth_ntlm ' ]);
@@ -212,14 +221,6 @@ public function request(string $method, string $url, array $options = []): Respo
212
221
$ curlopts [CURLOPT_RESOLVE ] = $ resolve ;
213
222
}
214
223
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
-
223
224
if ('POST ' === $ method ) {
224
225
// Use CURLOPT_POST to have browser-like POST-to-GET redirects for 301, 302 and 303
225
226
$ curlopts [CURLOPT_POST ] = true ;
0 commit comments