Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Connection:close header only when needed #657

Merged
merged 3 commits into from
Aug 17, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions 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 @@ -363,8 +364,10 @@ 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'])) {
$headers['Connection'] = 'close';
if ($this->version < self::CURL_7_22_0) {
if (!isset($headers['Connection'])) {
mircobabini marked this conversation as resolved.
Show resolved Hide resolved
$headers['Connection'] = 'close';
}
mircobabini marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down