Skip to content

Commit

Permalink
Merge pull request #657 from mircobabini/develop
Browse files Browse the repository at this point in the history
Add Connection:close header only when needed
  • Loading branch information
jrfnl committed Aug 17, 2023
2 parents 4656b0f + daf8a04 commit c7e62be
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Transport/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
final class Curl implements Transport {
const CURL_7_10_5 = 0x070A05;
const CURL_7_16_2 = 0x071002;
const CURL_7_22_0 = 0x071600;

/**
* Raw HTTP data
Expand Down Expand Up @@ -380,7 +381,7 @@ private function setup_handle($url, $headers, $data, $options) {
$options['hooks']->dispatch('curl.before_request', [&$this->handle]);

// Force closing the connection for old versions of cURL (<7.22).
if (!isset($headers['Connection'])) {
if ($this->version < self::CURL_7_22_0 && !isset($headers['Connection'])) {
$headers['Connection'] = 'close';
}

Expand Down

0 comments on commit c7e62be

Please sign in to comment.