Index: branches/5.2.x/core/units/helpers/curl_helper.php =================================================================== diff -u -N -r16339 -r16751 --- branches/5.2.x/core/units/helpers/curl_helper.php (.../curl_helper.php) (revision 16339) +++ branches/5.2.x/core/units/helpers/curl_helper.php (.../curl_helper.php) (revision 16751) @@ -1,6 +1,6 @@ requestMethod = self::REQUEST_METHOD_GET; $this->requestData = ''; $this->requestHeaders = Array (); + $this->responseHeaders = Array (); $this->options = Array (); } @@ -227,7 +228,7 @@ $default_options[CURLOPT_POSTFIELDS] = $this->requestData; } -// $default_options[CURLOPT_HEADERFUNCTION] = Array(&$this, 'ParseHeader'); + $default_options[CURLOPT_HEADERFUNCTION] = array(&$this, 'ParseHeader'); $user_options = $this->options; // backup options, that user set directly $this->setOptions($default_options); @@ -257,8 +258,12 @@ */ protected function ParseHeader(&$ch, $header) { - $this->responseHeaders[] = $header; + $trimmed_header = rtrim($header); + if ( $trimmed_header ) { + $this->responseHeaders[] = $trimmed_header; + } + return strlen($header); } @@ -392,8 +397,6 @@ $this->logId = $this->Conn->getInsertID(); } - $this->responseHeaders = Array (); - $this->prepareOptions(); $this->lastResponse = $this->_sendRequest(); @@ -498,6 +501,16 @@ } /** + * Returns response headers. + * + * @return array + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** * Detects, that follow location can't be done automatically by curl due safe_mode/open_basedir restrictions * * @return bool @@ -570,4 +583,4 @@ return ($this->lastHTTPCode == 200) || ($this->lastHTTPCode >= 300 && $this->lastHTTPCode < 310); } - } \ No newline at end of file + }