Skip to content

Commit

Permalink
⚡ better conditioning in http class
Browse files Browse the repository at this point in the history
  • Loading branch information
tracend committed Mar 11, 2024
1 parent 71c5e4e commit 377df6d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/lib/class.http.php
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ function execute($target = '', $referrer = '', $method = '', $data = array())
$requestHeader .= "Content-Type: application/x-www-form-urlencoded\r\n";

// Specify the custom cookies
if ($this->useCookie && $cookieString != '')
if ($this->useCookie && !empty($cookieString) )
{
$requestHeader.= "Cookie: " . $cookieString . "\r\n";
}
Expand Down Expand Up @@ -802,6 +802,8 @@ function execute($target = '', $referrer = '', $method = '', $data = array())
// Parse the headers
$this->_parseHeaders($responseHeader);

// FIX: status may be array
if( is_array($this->status) ) $this->status = $this->status[0];
// Do we have a 301/302 redirect ?
if (($this->status == '301' || $this->status == '302') && $this->redirect == TRUE)
{
Expand Down Expand Up @@ -841,7 +843,7 @@ function execute($target = '', $referrer = '', $method = '', $data = array())
else
{
// Nope...so lets get the rest of the contents (non-chunked)
if ($this->headers['transfer-encoding'] != 'chunked')
if (array_key_exists('transfer-encoding', $this->headers) && $this->headers['transfer-encoding'] != 'chunked')
{
while (!feof($filePointer))
{
Expand Down

0 comments on commit 377df6d

Please sign in to comment.