1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-02-08 03:54:20 +01:00

Cosmetic changes.

This commit is contained in:
Jean Paul Galea 2015-07-17 21:54:51 +02:00
parent a28ad6df69
commit 73943ba807

View File

@ -148,17 +148,16 @@ function curl_opt_name($opt)
// long as one of the URLs given work, data will be returned. If all
// URLs fail, data from some URL that did not match parameter $match
// (defaults to ^OK) is returned, or if all URLs failed, false.
function retrieveURLasync ($ident, $urls, $logger, $ans_req=1, $match="^OK", $returl=False, $timeout=10, $curlopts) {
function retrieveURLasync($ident, $urls, $logger, $ans_req=1, $match="^OK", $returl=False, $timeout=10, $curlopts)
{
$mh = curl_multi_init();
$ch = array();
foreach ($urls as $id => $url) {
foreach ($urls as $id => $url)
{
$handle = curl_init();
curl_settings($logger, $ident, $handle, $url, $timeout, $curlopts);
curl_multi_add_handle($mh, $handle);
$ch[$handle] = $handle;
}
@ -166,13 +165,16 @@ function retrieveURLasync ($ident, $urls, $logger, $ans_req=1, $match="^OK", $re
$ans_count = 0;
$ans_arr = array();
do {
while (($mrc = curl_multi_exec($mh, $active)) == CURLM_CALL_MULTI_PERFORM)
;
do
{
while (($mrc = curl_multi_exec($mh, $active)) == CURLM_CALL_MULTI_PERFORM);
while ($info = curl_multi_info_read($mh)) {
while ($info = curl_multi_info_read($mh))
{
$logger->log(LOG_DEBUG, $ident . " curl multi info : ", $info);
if ($info['result'] == CURLE_OK) {
if ($info['result'] == CURLE_OK)
{
$str = curl_multi_getcontent($info['handle']);
$logger->log(LOG_DEBUG, $ident . " curl multi content : " . $str);
if (preg_match("/".$match."/", $str)) {
@ -203,9 +205,11 @@ function retrieveURLasync ($ident, $urls, $logger, $ans_req=1, $match="^OK", $re
curl_multi_select ($mh);
}
} while($active);
}
while($active);
foreach ($ch as $h) {
foreach ($ch as $h)
{
curl_multi_remove_handle ($mh, $h);
curl_close ($h);
}