Skip to content

[HttpClient] Improv curl error message #37666

@viniciusss

Description

@viniciusss

Description
The curl_error function returns a clear message, that can help to understand the error. For exemple:

Message with curl_error

SSL connect error for "https://*.*.*.*:9910/Login". Detailed: error:141A318A:SSL routines:tls_process_ske_dhe:dh key too small.

Message with curl_strerror

SSL connect error for "https://*.*.*.*:9910/Login".

Example
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpClient/Response/CurlResponse.php#L321

- $multi->handlesActivity[$id][] = \in_array($result, [CURLE_OK, CURLE_TOO_MANY_REDIRECTS], true) || '_0' === $waitFor || curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD) === curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD) ? null : new TransportException(sprintf('%s for "%s".', curl_strerror($result), curl_getinfo($ch, CURLINFO_EFFECTIVE_URL)));
+ $multi->handlesActivity[$id][] = \in_array($result, [CURLE_OK, CURLE_TOO_MANY_REDIRECTS], true) || '_0' === $waitFor || curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD) === curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD) ? null : new TransportException(sprintf('%s for "%s". Detailed: %s.', curl_strerror($result), curl_getinfo($ch, CURLINFO_EFFECTIVE_URL), curl_error($ch)));

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