Skip to content

Commit 697ddb7

Browse files
[HttpClient] fix compat with cURL <= 7.37
1 parent f2ede9c commit 697ddb7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

CurlHttpClient.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public function request(string $method, string $url, array $options = []): Respo
311311
}
312312

313313
foreach ($curlopts as $opt => $value) {
314-
if (null !== $value && !curl_setopt($ch, $opt, $value) && \CURLOPT_CERTINFO !== $opt) {
314+
if (null !== $value && !curl_setopt($ch, $opt, $value) && \CURLOPT_CERTINFO !== $opt && (!\defined('CURLOPT_HEADEROPT') || \CURLOPT_HEADEROPT !== $opt)) {
315315
$constantName = $this->findConstantName($opt);
316316
throw new TransportException(sprintf('Curl option "%s" is not supported.', $constantName ?? $opt));
317317
}
@@ -574,7 +574,6 @@ private function validateExtraCurlOptions(array $options): void
574574
\CURLOPT_HEADER,
575575
\CURLOPT_CONNECTTIMEOUT,
576576
\CURLOPT_CONNECTTIMEOUT_MS,
577-
\CURLOPT_HEADEROPT,
578577
\CURLOPT_HTTP_VERSION,
579578
\CURLOPT_PORT,
580579
\CURLOPT_DNS_USE_GLOBAL_CACHE,
@@ -588,6 +587,10 @@ private function validateExtraCurlOptions(array $options): void
588587
$curloptsToCheck[] = \CURLOPT_HTTP09_ALLOWED;
589588
}
590589

590+
if (\defined('CURLOPT_HEADEROPT')) {
591+
$curloptsToCheck[] = \CURLOPT_HEADEROPT;
592+
}
593+
591594
$methodOpts = [
592595
\CURLOPT_POST,
593596
\CURLOPT_PUT,

0 commit comments

Comments
 (0)