stevenmaguire / trello-php

A php client for consuming the Trello API
MIT License
87 stars 25 forks source link

cURL error 56: SSL read: errno -5961 #24

Closed dragonee closed 7 years ago

dragonee commented 7 years ago

Hi! Thanks for creating this API, it's very handy :)

Using your library me and my friend have encountered a very strange behaviour. After some hours of tinkering with it, we've reduced the problem to the following:

1) All SSL calls on our machine are ok, until curl gets a large response (that involves many calls to CURL_READFUNCTION). In that case the code fails with the following messages:

cURL error 56: SSL read: errno -5961 cURL error 56: SSL read: error:00000000:lib(0):func(0):reason(0), errno 54 (curl 7.53.1, openssl 1.0.2k) 200 OK (misleading because underlying exception is the one above)

2) There are no problems with HTTP calls. 3) We think that the problem is caused by multipart GET requests, as these are called all the time even if there is no multipart content to be put in the request body. Simply changing the following line in /vendor/stevenmaguire/trello-php/src/Http.php causes the problem to stop appearing:

-'multipart' => $this->multipartResources,
+'multipart' => count($this->multipartResources) > 0 ? $this->multipartResources : null,

We are not sure what exactly happens in the communication between the client and server and why, so I'd say this needs more testing. As for now it had resolved problems within a specific call to the api on both machines we tested on, but we did not check it thoroughly. I'd consider our findings rather a suggestion now. :)

Package versions: guzzle 6.2.3, trello-php 0.4.0

If you need more information or a test case I'll try to prepare something.

stevenmaguire commented 7 years ago

Can you submit a PR please?

dragonee commented 7 years ago

Here it is :)

stevenmaguire commented 7 years ago

Code updated; release cut.