Allow for HTTP redirects

* In case of a redirect the return code does NOT overwrite the original return code
* It's stored in the result's `redirect_code` instead, so check that as well
This commit is contained in:
Oliver Behnke 2021-03-10 14:06:26 +01:00
parent 51ec5b7015
commit 4c7e613333
2 changed files with 2 additions and 2 deletions

View File

@ -381,7 +381,7 @@ function boincstats_get_project_stats($type = 'total', $cpid = NULL) {
$stats_xml = NULL;
$target_url = "http://{$stats_server}/{$stats_rpc}{$query}";
$result = drupal_http_request($target_url);
if (in_array($result->code, array(200, 304))) {
if (in_array($result->code, array(200, 304)) || in_array($result->redirect_code, array(200, 304))) {
$stats_xml = simplexml_load_string($result->data);
}
watchdog('boincstats', $target_url);

View File

@ -2242,7 +2242,7 @@ function boincuser_get_stats_user_data($cpid = null) {
// Load XML from RPC
$target_url = "http://{$stats_server}/{$stats_rpc}{$query}";
$result = drupal_http_request($target_url);
if (in_array($result->code, array(200, 304))) {
if (in_array($result->code, array(200, 304)) || in_array($result->redirect_code, array(200, 304))) {
return simplexml_load_string($result->data);
}
return NULL;