Permalink
Browse files

Only parse HTTP response headers if present.

  • Loading branch information...
1 parent 8070975 commit 99729c0bbbb784f0b45fcec473b5609c58325d31 Anton Lindqvist committed Jan 16, 2013
Showing with 9 additions and 6 deletions.
  1. +9 −6 Services/Soundcloud.php
View
15 Services/Soundcloud.php
@@ -921,13 +921,16 @@ protected function _request($url, $curlOptions = array())
curl_close($ch);
- $this->_lastHttpResponseHeaders = $this->_parseHttpHeaders(
- substr($data, 0, $info['header_size'])
- );
- if(array_key_exists(CURLOPT_HEADER, $options) && !$options[CURLOPT_HEADER])
- $this->_lastHttpResponseBody = $data;
- else
+ if (array_key_exists(CURLOPT_HEADER, $options) && $options[CURLOPT_HEADER]) {
+ $this->_lastHttpResponseHeaders = $this->_parseHttpHeaders(
+ substr($data, 0, $info['header_size'])
+ );
$this->_lastHttpResponseBody = substr($data, $info['header_size']);
+ } else {
+ $this->_lastHttpResponseHeaders = array();
+ $this->_lastHttpResponseBody = $data;
+ }
+
$this->_lastHttpResponseCode = $info['http_code'];
if ($this->_validResponseCode($this->_lastHttpResponseCode)) {

0 comments on commit 99729c0

Please sign in to comment.