20 require_once
"Auth/Yadis/PlainHTTPFetcher.php";
21 require_once
"Auth/Yadis/ParanoidHTTPFetcher.php";
26 require_once
"Auth/Yadis/ParseHTML.php";
31 require_once
"Auth/Yadis/XRDS.php";
36 define(
'Auth_Yadis_CONTENT_TYPE',
'application/xrds+xml');
41 define(
'Auth_Yadis_HEADER_NAME',
'X-XRDS-Location');
99 return $this->xrds->services();
108 return ($this->xrds_uri && $this->normalized_uri != $this->xrds_uri);
137 $discover_func=null, $fetcher=null)
139 if ($discover_func === null) {
140 $discover_function = array(
'Auth_Yadis_Yadis',
'discover');
143 $yadis_result = call_user_func_array($discover_func,
144 array($input_url, &$fetcher));
146 if ($yadis_result === null) {
147 return array($input_url, array());
150 $endpoints = call_user_func_array($xrds_parse_func,
151 array($yadis_result->normalized_uri,
152 $yadis_result->response_text));
154 if ($endpoints === null) {
155 $endpoints = array();
158 return array($yadis_result->normalized_uri, $endpoints);
256 (!defined(
'Auth_Yadis_CURL_OVERRIDE'))) {
266 return function_exists(
'curl_init');
274 foreach ($header_list as
$name => $value) {
275 foreach ($names as $n) {
276 if (strtolower(
$name) == strtolower($n)) {
290 if ($content_type_header) {
291 $parts = explode(
";", $content_type_header);
292 return strtolower($parts[0]);
321 $extra_ns_map = null, $timeout = 20)
327 ', text/html; q=0.3, application/xhtml+xml; q=0.5');
329 if ($fetcher === null) {
333 $response = $fetcher->get($uri, $headers);
335 if (!$response || ($response->status != 200 and
336 $response->status != 206)) {
341 $result->normalized_uri = $response->final_url;
344 array(
'content-type'));
346 if ($result->content_type &&
349 $result->xrds_uri = $result->normalized_uri;
355 if (!$yadis_location) {
357 $yadis_location = $parser->getHTTPEquiv($response->body);
360 if ($yadis_location) {
361 $result->xrds_uri = $yadis_location;
363 $response = $fetcher->get($yadis_location);
365 if ((!$response) || ($response->status != 200 and
366 $response->status != 206)) {
373 array(
'content-type'));
377 $result->response_text = $response->body;