Skip to content

Commit

Permalink
Update Curl to respect case-insensitive headers
Browse files Browse the repository at this point in the history
According to RFC 2616 header names are case-insensitive: "Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive." - see https://tools.ietf.org/html/rfc2616#section-4.2

The "Set-Cookie" comparison in the previous version is case-sensitive and can cause problems with some (rare) HTTP servers.
  • Loading branch information
pmzandbergen authored Jul 26, 2020
1 parent 3008324 commit 44d88e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/internal/Magento/Framework/HTTP/Client/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,11 @@ protected function parseHeaders($ch, $data)
}

if (strlen($name)) {
if ("Set-Cookie" == $name) {
if (!isset($this->_responseHeaders[$name])) {
$this->_responseHeaders[$name] = [];
if ("set-cookie" == strtolower($name)) {
if (!isset($this->_responseHeaders['Set-Cookie'])) {
$this->_responseHeaders['Set-Cookie'] = [];
}
$this->_responseHeaders[$name][] = $value;
$this->_responseHeaders['Set-Cookie'][] = $value;
} else {
$this->_responseHeaders[$name] = $value;
}
Expand Down

0 comments on commit 44d88e6

Please sign in to comment.