Skip to content

Commit

Permalink
修复某些情况下Http Response可能返回空的第一行,导致解析header失败的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
xiezefan committed Jan 4, 2016
1 parent 3900848 commit 7c12343
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/JPush/JPush.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,13 @@ public function _request($url, $method, $body=null, $times=1) {
$body = substr($output, $header_size);
$headers = array();
foreach (explode("\r\n", $header_text) as $i => $line) {
if ($i === 0) {
$headers['http_code'] = $line;
} else {
list ($key, $value) = explode(': ', $line);
$headers[$key] = $value;
if (!empty($line)) {
if ($i === 0) {
$headers['http_code'] = $line;
} else {
list ($key, $value) = explode(': ', $line);
$headers[$key] = $value;
}
}
}
$response['headers'] = $headers;
Expand Down

0 comments on commit 7c12343

Please sign in to comment.