Skip to content

Commit

Permalink
Merge pull request #211 from rmccue/force-close-on-old-curl
Browse files Browse the repository at this point in the history
Force closing keep-alive connections on old cURL
  • Loading branch information
rmccue committed May 13, 2016
2 parents 8b6a253 + fd34acb commit 95518ce
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions library/Requests/Transport/cURL.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 95518ce

Please sign in to comment.