ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
Auth_Yadis_HTTPFetcher Class Reference
+ Inheritance diagram for Auth_Yadis_HTTPFetcher:
+ Collaboration diagram for Auth_Yadis_HTTPFetcher:

Public Member Functions

 canFetchURL ($url)
 Return whether a URL can be fetched.
 allowedURL ($url)
 Return whether a URL should be allowed.
 supportsSSL ()
 Does this fetcher implementation (and runtime) support fetching HTTPS URLs? May inspect the runtime environment.
 isHTTPS ($url)
 Is this an https URL?
 URLHasAllowedScheme ($url)
 Is this an http or https URL?
 _findRedirect ($headers, $url)
 private
 get ($url, $headers=null)
 Fetches the specified URL using optional extra headers and returns the server's response.

Data Fields

 $timeout = 20

Detailed Description

Definition at line 43 of file HTTPFetcher.php.

Member Function Documentation

Auth_Yadis_HTTPFetcher::_findRedirect (   $headers,
  $url 
)

private

Definition at line 117 of file HTTPFetcher.php.

Referenced by Auth_Yadis_PlainHTTPFetcher\get(), and Auth_Yadis_ParanoidHTTPFetcher\get().

{
foreach ($headers as $line) {
if (strpos(strtolower($line), "location: ") === 0) {
$parts = explode(" ", $line, 2);
$loc = $parts[1];
$ppos = strpos($loc, "://");
if ($ppos === false || $ppos > strpos($loc, "/")) {
/* no host; add it */
$hpos = strpos($url, "://");
$prt = substr($url, 0, $hpos+3);
$url = substr($url, $hpos+3);
if (substr($loc, 0, 1) == "/") {
/* absolute path */
$fspos = strpos($url, "/");
if ($fspos) $loc = $prt.substr($url, 0, $fspos).$loc;
else $loc = $prt.$url.$loc;
} else {
/* relative path */
$pp = $prt;
while (1) {
$xpos = strpos($url, "/");
if ($xpos === false) break;
$apos = strpos($url, "?");
if ($apos !== false && $apos < $xpos) break;
$apos = strpos($url, "&");
if ($apos !== false && $apos < $xpos) break;
$pp .= substr($url, 0, $xpos+1);
$url = substr($url, $xpos+1);
}
$loc = $pp.$loc;
}
}
return $loc;
}
}
return null;

+ Here is the caller graph for this function:

Auth_Yadis_HTTPFetcher::allowedURL (   $url)

Return whether a URL should be allowed.

Override this method to conform to your local policy.

By default, will attempt to fetch any http or https URL.

Definition at line 77 of file HTTPFetcher.php.

Referenced by Auth_Yadis_ParanoidHTTPFetcher\get().

{
return $this->URLHasAllowedScheme($url);

+ Here is the caller graph for this function:

Auth_Yadis_HTTPFetcher::canFetchURL (   $url)

Return whether a URL can be fetched.

Returns false if the URL scheme is not allowed or is not supported by this fetcher implementation; returns true otherwise.

Returns
bool

Definition at line 54 of file HTTPFetcher.php.

Referenced by Auth_Yadis_PlainHTTPFetcher\get(), Auth_Yadis_ParanoidHTTPFetcher\get(), Auth_Yadis_PlainHTTPFetcher\post(), and Auth_Yadis_ParanoidHTTPFetcher\post().

{
if ($this->isHTTPS($url) && !$this->supportsSSL()) {
Auth_OpenID::log("HTTPS URL unsupported fetching %s",
$url);
return false;
}
if (!$this->allowedURL($url)) {
Auth_OpenID::log("URL fetching not allowed for '%s'",
$url);
return false;
}
return true;

+ Here is the caller graph for this function:

Auth_Yadis_HTTPFetcher::get (   $url,
  $headers = null 
)

Fetches the specified URL using optional extra headers and returns the server's response.

Parameters
string$urlThe URL to be fetched.
array$extra_headersAn array of header strings (e.g. "Accept: text/html").
Returns
mixed $result An array of ($code, $url, $headers, $body) if the URL could be fetched; null if the URL does not pass the URLHasAllowedScheme check or if the server's response is malformed.

Reimplemented in Auth_Yadis_ParanoidHTTPFetcher, and Auth_Yadis_PlainHTTPFetcher.

Definition at line 168 of file HTTPFetcher.php.

{
trigger_error("not implemented", E_USER_ERROR);
Auth_Yadis_HTTPFetcher::isHTTPS (   $url)

Is this an https URL?

private

Definition at line 99 of file HTTPFetcher.php.

Referenced by Auth_Yadis_ParanoidHTTPFetcher\get(), and Auth_Yadis_ParanoidHTTPFetcher\post().

{
return (bool)preg_match('/^https:\/\//i', $url);

+ Here is the caller graph for this function:

Auth_Yadis_HTTPFetcher::supportsSSL ( )

Does this fetcher implementation (and runtime) support fetching HTTPS URLs? May inspect the runtime environment.

Returns
bool $support True if this fetcher supports HTTPS fetching; false if not.

Reimplemented in Auth_Yadis_ParanoidHTTPFetcher, and Auth_Yadis_PlainHTTPFetcher.

Definition at line 89 of file HTTPFetcher.php.

{
trigger_error("not implemented", E_USER_ERROR);
Auth_Yadis_HTTPFetcher::URLHasAllowedScheme (   $url)

Is this an http or https URL?

private

Definition at line 109 of file HTTPFetcher.php.

{
return (bool)preg_match('/^https?:\/\//i', $url);

Field Documentation

Auth_Yadis_HTTPFetcher::$timeout = 20

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