Révision ed9a13f1
Ajouté par Assos Assos il y a plus de 3 ans
drupal7/sites/all/modules/feeds/libraries/http_request.inc | ||
---|---|---|
106 | 106 |
* If the URL uses authentication, supply the password. |
107 | 107 |
* @param bool $accept_invalid_cert |
108 | 108 |
* Whether to accept invalid certificates. |
109 |
* @param integer $timeout
|
|
109 |
* @param int $timeout |
|
110 | 110 |
* Timeout in seconds to wait for an HTTP get request to finish. |
111 | 111 |
* |
112 |
* @return stdClass
|
|
112 |
* @return object
|
|
113 | 113 |
* An object that describes the data downloaded from $url. |
114 | 114 |
*/ |
115 | 115 |
function http_request_get($url, $username = NULL, $password = NULL, $accept_invalid_cert = FALSE, $timeout = NULL) { |
... | ... | |
137 | 137 |
* - cache_http_result: (bool) Whether to cache the HTTP result. Defaults to |
138 | 138 |
* TRUE. |
139 | 139 |
* |
140 |
* @return stdClass
|
|
140 |
* @return object
|
|
141 | 141 |
* An object that describes the data downloaded from $url. |
142 | 142 |
*/ |
143 | 143 |
function feeds_http_request($url, array $options = array()) { |
... | ... | |
212 | 212 |
|
213 | 213 |
// Parse the URL and make sure we can handle the schema. |
214 | 214 |
// cURL can only support either http:// or https://. |
215 |
// CURLOPT_PROTOCOLS is only supported with cURL 7.19.4 |
|
215 |
// CURLOPT_PROTOCOLS is only supported with cURL 7.19.4.
|
|
216 | 216 |
$uri = parse_url($url); |
217 | 217 |
if ($uri === FALSE) { |
218 | 218 |
$result->error = 'unable to parse URL'; |
... | ... | |
241 | 241 |
$download = curl_init($url); |
242 | 242 |
curl_setopt($download, CURLOPT_FOLLOWLOCATION, TRUE); |
243 | 243 |
if (!empty($options['username'])) { |
244 |
curl_setopt($download, CURLOPT_USERPWD, '{' . $options['username'] . '}:{' . $options['password'] . '}');
|
|
244 |
curl_setopt($download, CURLOPT_USERPWD, $options['username'] . ':' . $options['password']);
|
|
245 | 245 |
curl_setopt($download, CURLOPT_HTTPAUTH, CURLAUTH_ANY); |
246 | 246 |
} |
247 | 247 |
curl_setopt($download, CURLOPT_HTTPHEADER, $headers); |
... | ... | |
429 | 429 |
|
430 | 430 |
// cURL below PHP 5.6.0 must not have open_basedir or safe_mode enabled. |
431 | 431 |
if (version_compare(PHP_VERSION, '5.6.0', '<')) { |
432 |
// phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved |
|
432 | 433 |
return !ini_get('safe_mode') && !ini_get('open_basedir'); |
433 | 434 |
} |
434 | 435 |
|
... | ... | |
465 | 466 |
* |
466 | 467 |
* @param string $url |
467 | 468 |
* The URL to cache. |
468 |
* @param stdClass $result
|
|
469 |
* @param object $result
|
|
469 | 470 |
* The result of the HTTP request. |
470 | 471 |
*/ |
471 | 472 |
function http_request_set_cache($url, $result) { |
... | ... | |
582 | 583 |
|
583 | 584 |
// Adding to the existing path. |
584 | 585 |
$cparts = array(); |
585 |
if ($url{0} == '/') {
|
|
586 |
if ($url[0] == '/') {
|
|
586 | 587 |
$cparts = array_filter(explode("/", $url)); |
587 | 588 |
} |
588 | 589 |
else { |
Formats disponibles : Unified diff
Weekly update of contrib modules