diff --git a/library/Requests/Transport/cURL.php b/library/Requests/Transport/cURL.php index 5f5c5dfb0..04914440e 100755 --- a/library/Requests/Transport/cURL.php +++ b/library/Requests/Transport/cURL.php @@ -309,6 +309,11 @@ public function &get_subrequest_handle($url, $headers, $data, $options) { protected function setup_handle($url, $headers, $data, $options) { $options['hooks']->dispatch('curl.before_request', array(&$this->handle)); + // Force closing the connection for old versions of cURL (<7.22). + if ( ! isset( $headers['Connection'] ) ) { + $headers['Connection'] = 'close'; + } + $headers = Requests::flatten($headers); if (!empty($data)) {