19 require_once
"Auth/Yadis/HTTPFetcher.php";
21 require_once
"Auth/OpenID.php";
37 $this->headers = array();
46 array_push($this->headers, rtrim($header));
47 return strlen($header);
70 return in_array(
'https', $v[
'protocols']);
71 } elseif (is_string($v)) {
72 return preg_match(
'/OpenSSL/i', $v);
78 function get($url, $extra_headers = null)
89 while ($redir && ($off > 0)) {
93 if (defined(
'Auth_OpenID_DISABLE_SSL_VERIFYPEER')
94 && Auth_OpenID_DISABLE_SSL_VERIFYPEER ===
true) {
96 'You have disabled SSL verifcation, this is a TERRIBLE ' .
97 'idea in almost all cases. Set Auth_OpenID_DISABLE_SSL_' .
98 'VERIFYPEER to false if you want to be safe again',
100 curl_setopt($c, CURLOPT_SSL_VERIFYPEER,
false);
105 "curl_init returned false; could not " .
106 "initialize for URL '%s'", $url);
110 if (defined(
'CURLOPT_NOSIGNAL')) {
111 curl_setopt($c, CURLOPT_NOSIGNAL,
true);
120 curl_setopt($c, CURLOPT_WRITEFUNCTION,
121 array($this,
"_writeData"));
122 curl_setopt($c, CURLOPT_HEADERFUNCTION,
123 array($this,
"_writeHeader"));
125 if ($extra_headers) {
126 curl_setopt($c, CURLOPT_HTTPHEADER, $extra_headers);
129 $cv = curl_version();
131 $curl_user_agent =
'curl/'.$cv[
'version'];
133 $curl_user_agent = $cv;
135 curl_setopt($c, CURLOPT_USERAGENT,
137 curl_setopt($c, CURLOPT_TIMEOUT, $off);
138 curl_setopt($c, CURLOPT_URL, $url);
140 if (defined(
'Auth_OpenID_VERIFY_HOST')) {
143 if (Auth_OpenID_VERIFY_HOST) {
144 curl_setopt($c, CURLOPT_SSL_VERIFYPEER,
true);
145 curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2);
146 if (defined(
'Auth_OpenID_CAINFO')) {
147 curl_setopt($c, CURLOPT_CAINFO, Auth_OpenID_CAINFO);
150 curl_setopt($c, CURLOPT_SSL_VERIFYPEER,
false);
153 if (defined(
'Auth_OpenID_HTTP_PROXY')) {
154 curl_setopt($c, CURLOPT_PROXY, Auth_OpenID_HTTP_PROXY);
158 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'curlProxyServer']) {
159 curl_setopt($c, CURLOPT_PROXY,
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'curlProxyServer']);
161 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'curlProxyTunnel']) {
162 curl_setopt($c, CURLOPT_HTTPPROXYTUNNEL,
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'curlProxyTunnel']);
164 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'curlProxyUserPass']) {
165 curl_setopt($c, CURLOPT_PROXYUSERPWD,
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'curlProxyUserPass']);
172 $code = curl_getinfo($c, CURLINFO_HTTP_CODE);
174 $headers = $this->headers;
179 curl_errno($c), curl_error($c));
183 if (in_array($code, array(301, 302, 303, 307))) {
190 if (defined(
'Auth_OpenID_VERIFY_HOST') &&
191 Auth_OpenID_VERIFY_HOST ==
true &&
196 $new_headers = array();
198 foreach ($headers as $header) {
199 if (strpos($header,
': ')) {
200 list($name, $value) = explode(
': ', $header, 2);
201 $new_headers[$name] = $value;
206 $new_headers, $body);
209 $off = $stop - time();
215 function post($url, $body, $extra_headers = null)
225 if (defined(
'CURLOPT_NOSIGNAL')) {
226 curl_setopt($c, CURLOPT_NOSIGNAL,
true);
229 if (defined(
'Auth_OpenID_HTTP_PROXY')) {
230 curl_setopt($c, CURLOPT_PROXY, Auth_OpenID_HTTP_PROXY);
234 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'curlProxyServer']) {
235 curl_setopt($c, CURLOPT_PROXY,
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'curlProxyServer']);
237 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'curlProxyTunnel']) {
238 curl_setopt($c, CURLOPT_HTTPPROXYTUNNEL,
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'curlProxyTunnel']);
240 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'curlProxyUserPass']) {
241 curl_setopt($c, CURLOPT_PROXYUSERPWD,
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'curlProxyUserPass']);
246 curl_setopt($c, CURLOPT_POST,
true);
247 curl_setopt($c, CURLOPT_POSTFIELDS, $body);
248 curl_setopt($c, CURLOPT_TIMEOUT, $this->timeout);
249 curl_setopt($c, CURLOPT_URL, $url);
250 curl_setopt($c, CURLOPT_WRITEFUNCTION,
251 array($this,
"_writeData"));
253 if (defined(
'Auth_OpenID_VERIFY_HOST')) {
256 if (Auth_OpenID_VERIFY_HOST) {
257 curl_setopt($c, CURLOPT_SSL_VERIFYPEER,
true);
258 curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2);
259 if (defined(
'Auth_OpenID_CAINFO')) {
260 curl_setopt($c, CURLOPT_CAINFO, Auth_OpenID_CAINFO);
263 curl_setopt($c, CURLOPT_SSL_VERIFYPEER,
false);
269 $code = curl_getinfo($c, CURLINFO_HTTP_CODE);
274 curl_errno($c), curl_error($c));
278 if (defined(
'Auth_OpenID_VERIFY_HOST') &&
279 Auth_OpenID_VERIFY_HOST ==
true &&
288 $new_headers = $extra_headers;
290 foreach ($this->headers as $header) {
291 if (strpos($header,
': ')) {
292 list($name, $value) = explode(
': ', $header, 2);
293 $new_headers[$name] = $value;
299 $new_headers, $body);
const Auth_OpenID_FETCHER_MAX_RESPONSE_KB
const Auth_OpenID_USER_AGENT
_writeHeader($ch, $header)
_findRedirect($headers, $url)
Auth_Yadis_ParanoidHTTPFetcher()
post($url, $body, $extra_headers=null)
static log($format_string)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]