Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpClient] CurlHttpClient throws Undefined constant CURLOPT_PINNEDPUBLICKEY #42061

Closed
@sirian

Description

@sirian

Symfony version(s) affected: 5.3, 5.4

Description
Some CURL constants could be not defined depending on libcurl version.
Thus private CurlHttpClient::validateExtraCurlOptions throws Undefined constant "CURLOPT_PINNEDPUBLICKEY" even though user code doesn't use this constant.

\CURLOPT_PINNEDPUBLICKEY => 'peer_fingerprint',

For example CURLOPT_PINNEDPUBLICKEY requires libcurl 7.39.0

How to reproduce

You could try Centos 7 with remi PHP.

PHP 8.0.8
cURL support => enabled
cURL Information => 7.29.0
$client = new CurlHttpClient();
$response = $client->request('GET', 'https://download.geonames.org/export/dump/alternatenames/RU.zip', [
    'extra' => [
        'curl' => [
            CURLOPT_MAX_RECV_SPEED_LARGE => 1024
        ]
    ]
]);
var_dump(strlen($response->getContent()));

Possible Solution
Check that constant is defined(...) or add polyfill

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions