HTTPFetcher.php

Go to the documentation of this file.
00001 <?php
00002 
00019 require_once "Auth/OpenID.php";
00020 
00021 define('Auth_OpenID_FETCHER_MAX_RESPONSE_KB', 1024);
00022 define('Auth_OpenID_USER_AGENT', 
00023        'php-openid/'.Auth_OpenID_VERSION.' (php/'.phpversion().')');
00024 
00025 class Auth_Yadis_HTTPResponse {
00026     function Auth_Yadis_HTTPResponse($final_url = null, $status = null,
00027                                          $headers = null, $body = null)
00028     {
00029         $this->final_url = $final_url;
00030         $this->status = $status;
00031         $this->headers = $headers;
00032         $this->body = $body;
00033     }
00034 }
00035 
00044 class Auth_Yadis_HTTPFetcher {
00045 
00046     var $timeout = 20; // timeout in seconds.
00047 
00055     function canFetchURL($url)
00056     {
00057         if ($this->isHTTPS($url) && !$this->supportsSSL()) {
00058             Auth_OpenID::log("HTTPS URL unsupported fetching %s",
00059                              $url);
00060             return false;
00061         }
00062 
00063         if (!$this->allowedURL($url)) {
00064             Auth_OpenID::log("URL fetching not allowed for '%s'",
00065                              $url);
00066             return false;
00067         }
00068 
00069         return true;
00070     }
00071 
00078     function allowedURL($url)
00079     {
00080         return $this->URLHasAllowedScheme($url);
00081     }
00082 
00090     function supportsSSL()
00091     {
00092         trigger_error("not implemented", E_USER_ERROR);
00093     }
00094 
00100     function isHTTPS($url)
00101     {
00102         return (bool)preg_match('/^https:\/\//i', $url);
00103     }
00104 
00110     function URLHasAllowedScheme($url)
00111     {
00112         return (bool)preg_match('/^https?:\/\//i', $url);
00113     }
00114 
00118     function _findRedirect($headers)
00119     {
00120         foreach ($headers as $line) {
00121             if (strpos(strtolower($line), "location: ") === 0) {
00122                 $parts = explode(" ", $line, 2);
00123                 return $parts[1];
00124             }
00125         }
00126         return null;
00127     }
00128 
00141     function get($url, $headers)
00142     {
00143         trigger_error("not implemented", E_USER_ERROR);
00144     }
00145 }
00146 
00147 ?>

Generated on Thu Feb 19 15:02:21 2009 for OXID eShop CE by  doxygen 1.5.5