Skip to content

Commit 44d88e6

Browse files
authored
Update Curl to respect case-insensitive headers
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.
1 parent 3008324 commit 44d88e6

File tree

1 file changed

+4
-4
lines changed
  • lib/internal/Magento/Framework/HTTP/Client

1 file changed

+4
-4
lines changed

lib/internal/Magento/Framework/HTTP/Client/Curl.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,11 @@ protected function parseHeaders($ch, $data)
453453
}
454454

455455
if (strlen($name)) {
456-
if ("Set-Cookie" == $name) {
457-
if (!isset($this->_responseHeaders[$name])) {
458-
$this->_responseHeaders[$name] = [];
456+
if ("set-cookie" == strtolower($name)) {
457+
if (!isset($this->_responseHeaders['Set-Cookie'])) {
458+
$this->_responseHeaders['Set-Cookie'] = [];
459459
}
460-
$this->_responseHeaders[$name][] = $value;
460+
$this->_responseHeaders['Set-Cookie'][] = $value;
461461
} else {
462462
$this->_responseHeaders[$name] = $value;
463463
}

0 commit comments

Comments
 (0)