Reputation: 2463
I am getting this error on one function in my laravel application. yesterday everything worked fine.
cURL error 56: SSL read: error:00000000:lib(0):func(0):reason(0), errno 104 (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
in CurlFactory.php line 187 at CurlFactory::createRejection(object(EasyHandle), array('errno' => '56', 'error' => 'SSL read: error:00000000:lib(0):func(0):reason(0), errno 104', 'url' => 'https://server7.phasehosting.io:2087/json-api/dumpzone?&domain=phasedev.be', 'content_type' => null, 'http_code' => '0', 'header_size' => '0', 'request_size' => '1174', 'filetime' => '-1', 'ssl_verify_result' => '0', 'redirect_count' => '0', 'total_time' => '2.30737', 'namelookup_time' => '0.004516', 'connect_time' => '0.02006', 'pretransfer_time' => '0.06986', 'size_upload' => '0', 'size_download' => '0', 'speed_download' => '0', 'speed_upload' => '0', 'download_content_length' => '-1', 'upload_content_length' => '-1', 'starttransfer_time' => '0', 'redirect_time' => '0', 'redirect_url' => '', 'primary_ip' => '37.97.192.223', 'certinfo' => array(), 'primary_port' => '2087', 'local_ip' => '10.0.2.15', 'local_port' => '48858')) in CurlFactory.php line 150
When I specify the wrong parameters for the API call I get a server error response that I need to define the right parameters, when I specify the right parameters I get the Curl error.
When using postman to make the request I get a successfull response
Other API calls do work as intended. So I'm kind of confused right now. Where should I look?
This is the function that runs the query:
protected function runQuery($action, $arguments)
{
$host = $this->getHost();
$client = new Client(['base_uri' => $host]);
try{
$response = $client->post('/json-api/' . $action, [
'headers' => $this->createHeader(),
// 'body' => $arguments[0],
'verify' => false,
'query' => $arguments,
'timeout' => $this->getTimeout(),
'connect_timeout' => $this->getConnectionTimeout()
]);
return (string) $response->getBody();
}
catch(\GuzzleHttp\Exception\ClientException $e)
{
return $e->getMessage();
}
}
Upvotes: 0
Views: 4297
Reputation: 81
I experienced this problem and finally solved it.
Before you push anything into the header, make sure you echo
it out. You can also use dd($some_header_variable)
and eyeball every header variable that you have one at a time. Pay special attention to variables that hold URL values.
For my case, one of the header variables I had was not resolving to the correct value. Unfortunately guzzle, seemingly, does not do any error handling on headers.
For your case, first, try to dd($host)
in the browser and assert that the intended value of $host
is displayed.
Upvotes: 0
Reputation: 1857
Which version of Guzzle are you using? Make sure it's not the outdated one. Guzzle bumped versions recently with BC problems.
Upvotes: 0