ILIAS  release_4-4 Revision
Auth_Yadis_ProxyResolver Class Reference

Code for using a proxy XRI resolver. More...

+ Collaboration diagram for Auth_Yadis_ProxyResolver:

Public Member Functions

 Auth_Yadis_ProxyResolver ($fetcher, $proxy_url=null)
 
 queryURL ($xri, $service_type=null)
 
 query ($xri, $service_types, $filters=array())
 

Detailed Description

Code for using a proxy XRI resolver.

Definition at line 10 of file XRIRes.php.

Member Function Documentation

◆ Auth_Yadis_ProxyResolver()

Auth_Yadis_ProxyResolver::Auth_Yadis_ProxyResolver (   $fetcher,
  $proxy_url = null 
)

Definition at line 11 of file XRIRes.php.

References Auth_Yadis_getDefaultProxy().

12  {
13  $this->fetcher = $fetcher;
14  $this->proxy_url = $proxy_url;
15  if (!$this->proxy_url) {
16  $this->proxy_url = Auth_Yadis_getDefaultProxy();
17  }
18  }
Auth_Yadis_getDefaultProxy()
Definition: XRI.php:16
+ Here is the call graph for this function:

◆ query()

Auth_Yadis_ProxyResolver::query (   $xri,
  $service_types,
  $filters = array() 
)

Definition at line 40 of file XRIRes.php.

References Auth_Yadis_getCanonicalID(), Auth_Yadis_XRDS\parseXRDS(), and queryURL().

41  {
42  $services = array();
43  $canonicalID = null;
44  foreach ($service_types as $service_type) {
45  $url = $this->queryURL($xri, $service_type);
46  $response = $this->fetcher->get($url);
47  if ($response->status != 200 and $response->status != 206) {
48  continue;
49  }
50  $xrds = Auth_Yadis_XRDS::parseXRDS($response->body);
51  if (!$xrds) {
52  continue;
53  }
54  $canonicalID = Auth_Yadis_getCanonicalID($xri,
55  $xrds);
56 
57  if ($canonicalID === false) {
58  return null;
59  }
60 
61  $some_services = $xrds->services($filters);
62  $services = array_merge($services, $some_services);
63  // TODO:
64  // * If we do get hits for multiple service_types, we're
65  // almost certainly going to have duplicated service
66  // entries and broken priority ordering.
67  }
68  return array($canonicalID, $services);
69  }
static parseXRDS($xml_string, $extra_ns_map=null)
Parse an XML string (XRDS document) and return either a Auth_Yadis_XRDS object or null...
Definition: XRDS.php:276
queryURL($xri, $service_type=null)
Definition: XRIRes.php:20
Auth_Yadis_getCanonicalID($iname, $xrds)
Definition: XRI.php:187
+ Here is the call graph for this function:

◆ queryURL()

Auth_Yadis_ProxyResolver::queryURL (   $xri,
  $service_type = null 
)

Definition at line 20 of file XRIRes.php.

References $query, Auth_Yadis_toURINormal(), and Auth_Yadis_XRIAppendArgs().

Referenced by query().

21  {
22  // trim off the xri:// prefix
23  $qxri = substr(Auth_Yadis_toURINormal($xri), 6);
24  $hxri = $this->proxy_url . $qxri;
25  $args = array(
26  '_xrd_r' => 'application/xrds+xml'
27  );
28 
29  if ($service_type) {
30  $args['_xrd_t'] = $service_type;
31  } else {
32  // Don't perform service endpoint selection.
33  $args['_xrd_r'] .= ';sep=false';
34  }
35 
36  $query = Auth_Yadis_XRIAppendArgs($hxri, $args);
37  return $query;
38  }
Auth_Yadis_XRIAppendArgs($url, $args)
Definition: XRI.php:97
Auth_Yadis_toURINormal($xri)
Definition: XRI.php:80
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: