8000 bug #41674 [HttpClient] fix compat with cURL <= 7.37 (nicolas-grekas) · symfony/symfony@a04effa · GitHub
[go: up one dir, main page]

Skip to content

Commit a04effa

Browse files
bug #41674 [HttpClient] fix compat with cURL <= 7.37 (nicolas-grekas)
This PR was merged into the 5.2 branch. Discussion ---------- [HttpClient] fix compat with cURL <= 7.37 | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #41662 | License | MIT | Doc PR | - Commits ------- d8adf51 [HttpClient] fix compat with cURL <= 7.37
2 parents 610b51d + d8adf51 commit a04effa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Symfony/Component/HttpClient/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)
0