Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Content Length Missing Causing "GnuTLS recv error (-110)" #865

Closed
Zortrox opened this issue Sep 30, 2021 · 0 comments
Closed

Content Length Missing Causing "GnuTLS recv error (-110)" #865

Zortrox opened this issue Sep 30, 2021 · 0 comments

Comments

@Zortrox
Copy link

Zortrox commented Sep 30, 2021

On our live server with SSL, I'm receiving an error on any event fired whenever Pusher sends a cURL request to the websocket server:
GnuTLS recv error (-110): The TLS connection was non-properly terminated.

I search for hours and eventually saw that in some versions of cURL that use GnuTLS, if an explicit "Content-Length" header isn't present, cURL outputs an error when the server closes the connection.

Server info:

PHP: 7.4.23
cURL: 7.68.0
GnuTLS: 3.6.13

Example PHP cURL code that would cause this error:

$full_url = 'https://api.example.com:6001/apps/{{appname}}/events?auth_key={{auth_key}}&auth_signature={{auth_signature}}&auth_timestamp=1632939475&auth_version=1.0&body_md5={{body_md5}}';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $full_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-type: application/json'
));

curl_setopt($ch, CURLOPT_POSTFIELDS, '{}');

$response = array();
$response['body'] = curl_exec($ch);
$response['status'] = curl_getinfo($ch, CURLINFO_HTTP_CODE);

var_dump($response, curl_error($ch));

I'm submitting a pull request now that should fix this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants