Skip to content

Commit

Permalink
Merge pull request #396 from DavidGoodwin/master
Browse files Browse the repository at this point in the history
Zend_Http_Client-Adapter_Socket - check transfer-encoding header is a string (and not an array)
  • Loading branch information
develart-projects authored Jan 26, 2024
2 parents ae0ac8f + 64b8699 commit dbdd481
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions library/Zend/Http/Client/Adapter/Socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public function read()
}

// If we got a 'transfer-encoding: chunked' header
if (isset($headers['transfer-encoding'])) {
if (isset($headers['transfer-encoding']) && is_string($headers['transfer-encoding'])) {

if (strtolower($headers['transfer-encoding']) == 'chunked') {

Expand Down Expand Up @@ -411,8 +411,12 @@ public function read()
} else {
$this->close();
require_once 'Zend/Http/Client/Adapter/Exception.php';
$encoding = $headers['transfer-encoding'];
if (is_array($encoding)) {
$encoding = json_encode($encoding);
}
throw new Zend_Http_Client_Adapter_Exception('Cannot handle "' .
$headers['transfer-encoding'] . '" transfer encoding');
$encoding . '" transfer encoding');
}

// We automatically decode chunked-messages when writing to a stream
Expand Down

0 comments on commit dbdd481

Please sign in to comment.