diff --git a/libraries/http_request.inc b/libraries/http_request.inc index 24cc431..2e41886 100644 --- a/libraries/http_request.inc +++ b/libraries/http_request.inc @@ -32,18 +32,8 @@ class HRCurlException extends Exception {} * no feeds. */ function http_request_get_common_syndication($url, $settings = NULL) { - if (valid_url($url, TRUE)) { - // Handle password protected feeds. - $url_parts = parse_url($url); - $password = $username = NULL; - if (!empty($url_parts['user'])) { - $password = $url_parts['pass']; - $username = $url_parts['user']; - } - } - $accept_invalid_cert = isset($settings['accept_invalid_cert']) ? $settings['accept_invalid_cert'] : FALSE; - $download = http_request_get($url, $username, $password, $accept_invalid_cert); + $download = http_request_get($url, NULL, NULL, $accept_invalid_cert); // Cannot get the feed, return. // http_request_get() always returns 200 even if its 304. @@ -84,6 +74,15 @@ function http_request_get_common_syndication($url, $settings = NULL) { * data property contains the actual document at the URL. */ function http_request_get($url, $username = NULL, $password = NULL, $accept_invalid_cert = FALSE) { + if (!$username && valid_url($url, TRUE)) { + // Handle password protected feeds. + $url_parts = parse_url($url); + if (!empty($url_parts['user'])) { + $password = $url_parts['pass']; + $username = $url_parts['user']; + } + } + // Intra-pagedownload cache, avoid to download the same content twice within one page download (it's possible, compatible and parse calls). static $download_cache = array(); if (isset($download_cache[$url])) {