com web/qa: Keep full response, even if github responds with 403: pulls/api.php
| From: | Johannes Schlüter | Date: | Tue, 07 May 2013 16:38:06 +0000 |
| Subject: | com web/qa: Keep full response, even if github responds with 403: pulls/api.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66861@lists.php.net to get a copy of this message | ||
Commit: 239016adc19a96b60d26bb0442cfd167a0776b18
Author: Johannes Schlüter <johannes@schlueters.de> Tue, 7 May 2013 18:38:06 +0200
Parents: f661d7805629af8da85e35fb8bcf740cd58eabfd
Branches: master
Link: http://git.php.net/?p=web/qa.git;a=commitdiff;h=239016adc19a96b60d26bb0442cfd167a0776b18
Log:
Keep full response, even if github responds with 403
Changed paths:
M pulls/api.php
Diff:
diff --git a/pulls/api.php b/pulls/api.php
index 9913e07..e8d49c9 100644
--- a/pulls/api.php
+++ b/pulls/api.php
@@ -176,9 +176,14 @@ function ghupdate()
}
$url =
GITHUB_BASEURL.'repos/'.GITHUB_ORG.'/'.urlencode($_POST['repo']).'/pulls/'.$_POST['id'];
- $pull_raw = @file_get_contents($url);
+ $ctxt = stream_context_create(array(
+ 'http' => array(
+ 'ignore_errors' => '1'
+ )
+ ));
+ $pull_raw = @file_get_contents($url, false, $ctxt);
$pull = $pull_raw ? json_decode($pull_raw) : false;
- if (!$pull) {
+ if (!$pull || empty($pull['state'])) {
header('HTTP/1.0 400 Bad Request');
$_SESSION['debug'][] = array(
"message" => "Request to GitHub failed",