From 4c7e6133336772a90c3d35e77e63cbb0dc77e97f Mon Sep 17 00:00:00 2001 From: Oliver Behnke Date: Wed, 10 Mar 2021 14:06:26 +0100 Subject: [PATCH] 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 --- drupal/sites/default/boinc/modules/boincstats/boincstats.module | 2 +- drupal/sites/default/boinc/modules/boincuser/boincuser.module | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drupal/sites/default/boinc/modules/boincstats/boincstats.module b/drupal/sites/default/boinc/modules/boincstats/boincstats.module index df8331fb99..4c20a62eef 100644 --- a/drupal/sites/default/boinc/modules/boincstats/boincstats.module +++ b/drupal/sites/default/boinc/modules/boincstats/boincstats.module @@ -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); diff --git a/drupal/sites/default/boinc/modules/boincuser/boincuser.module b/drupal/sites/default/boinc/modules/boincuser/boincuser.module index 7910d9a847..6e20da954f 100644 --- a/drupal/sites/default/boinc/modules/boincuser/boincuser.module +++ b/drupal/sites/default/boinc/modules/boincuser/boincuser.module @@ -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;