diff options
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php')
-rw-r--r-- | vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php index 278eeb422..4ad3f141d 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php @@ -34,7 +34,7 @@ class Curl extends Client * @access private * @var array */ - private $headers = array(); + private $response_headers = array(); /** * Counter on the number of header received @@ -42,7 +42,7 @@ class Curl extends Client * @access private * @var integer */ - private $headers_counter = 0; + private $response_headers_count = 0; /** * cURL callback to read the HTTP body @@ -81,15 +81,15 @@ class Curl extends Client $length = strlen($buffer); if ($buffer === "\r\n") { - $this->headers_counter++; + $this->response_headers_count++; } else { - if (! isset($this->headers[$this->headers_counter])) { - $this->headers[$this->headers_counter] = ''; + if (! isset($this->response_headers[$this->response_headers_count])) { + $this->response_headers[$this->response_headers_count] = ''; } - $this->headers[$this->headers_counter] .= $buffer; + $this->response_headers[$this->response_headers_count] .= $buffer; } return $length; @@ -153,6 +153,8 @@ class Curl extends Client $headers[] = 'If-Modified-Since: '.$this->last_modified; } + $headers = array_merge($headers, $this->request_headers); + return $headers; } @@ -234,6 +236,7 @@ class Curl extends Client curl_setopt($ch, CURLOPT_URL, $this->url); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout); curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent); curl_setopt($ch, CURLOPT_HTTPHEADER, $this->prepareHeaders()); @@ -302,7 +305,7 @@ class Curl extends Client { $this->executeContext(); - list($status, $headers) = HttpHeaders::parse(explode("\r\n", $this->headers[$this->headers_counter - 1])); + list($status, $headers) = HttpHeaders::parse(explode("\r\n", $this->response_headers[$this->response_headers_count - 1])); // When restricted with open_basedir if ($this->needToHandleRedirection($follow_location, $status)) { @@ -343,8 +346,8 @@ class Curl extends Client $this->url = Url::resolve($location, $this->url); $this->body = ''; $this->body_length = 0; - $this->headers = array(); - $this->headers_counter = 0; + $this->response_headers = array(); + $this->response_headers_count = 0; while (true) { @@ -360,8 +363,8 @@ class Curl extends Client $this->url = Url::resolve($result['headers']['Location'], $this->url); $this->body = ''; $this->body_length = 0; - $this->headers = array(); - $this->headers_counter = 0; + $this->response_headers = array(); + $this->response_headers_count = 0; } else { break; |