Skip to content
Snippets Groups Projects
Commit 5134f949 authored by Alexander Hass's avatar Alexander Hass
Browse files

#1429284: Followup - Only follow one redirect

parent 7f581deb
No related branches found
No related tags found
No related merge requests found
......@@ -222,25 +222,19 @@ function _linkchecker_status_handling($link, $response) {
$useragent = variable_get('linkchecker_check_useragent', 'Drupal (+http://drupal.org/)');
$ignore_response_codes = preg_split('/(\r\n?|\n)/', variable_get('linkchecker_ignore_response_codes', "200\n206\n302\n304\n401\n403"));
// FIXME: drupal_http_request() may not provide an UTF8 encoded error message
// what results in a database UPDATE failure. See http://drupal.org/node/371495
// for more information. ISO-8859-1 as source encoding may be wrong, but WFM.
if (!empty($response->error) && !drupal_validate_utf8($response->error)) {
$response->error = drupal_convert_to_utf8($response->error, 'ISO-8859-1');
}
// Prevent E_ALL warnings for non-existing $response->error.
if (!isset($response->error)) {
$response->error = '';
// - Prevent E_ALL warnings in DB updates for non-existing $response->error.
// - @todo drupal_http_request() may not provide an UTF8 encoded error message
// what results in a database UPDATE failure. For more information, see
// http://drupal.org/node/371495.
// Workaround: ISO-8859-1 as source encoding may be wrong, but WFM.
$response->error = trim(drupal_convert_to_utf8($errstr, 'ISO-8859-1'));
// Make response object consistent with HTTPRL.
if ($response->code == 301 && !isset($response->redirect_code)) {
$response->redirect_code = $response->code;
}
switch ($response->code) {
case 200:
case 206:
db_query("UPDATE {linkchecker_links} SET code = %d, error = '%s', fail_count = %d, last_checked = %d WHERE lid = %d", $response->code, $response->error, 0, time(), $link->lid);
//watchdog('linkchecker', 'Checked %link successfully.', array('%link' => $link->url), WATCHDOG_INFO);
break;
case 301:
db_query("UPDATE {linkchecker_links} SET code = %d, error = '%s', fail_count = fail_count+1, last_checked = %d WHERE lid = %d", $response->code, $response->error, time(), $link->lid);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment