X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Fparse_args.php;h=6660b9e83fdba2d80367de0a213dd76593ac6cbd;hb=19b99735570521d8172f73124ade5997b9dca75d;hp=18b6bc37806414419469e54fba6dc68d95279430;hpb=c79e320a2d513194a0e7b65d26407a45ae4cbdd3;p=plcapi.git diff --git a/tests/parse_args.php b/tests/parse_args.php index 18b6bc3..6660b9e 100644 --- a/tests/parse_args.php +++ b/tests/parse_args.php @@ -1,6 +1,7 @@ 'gggeek.ssl.altervista.org', 'HTTPSURI' => '/sw/xmlrpc/demo/server/server.php', 'HTTPSIGNOREPEER' => false, + 'HTTPSVERIFYHOST' => 2, + 'SSLVERSION' => 0, 'PROXYSERVER' => null, 'NOPROXY' => false, - 'LOCALPATH' => __DIR__ + 'LOCALPATH' => __DIR__, ); // check for command line vs web page input params - if(!isset($_SERVER['REQUEST_METHOD'])) - { - if(isset($argv)) - { - foreach($argv as $param) - { + if (!isset($_SERVER['REQUEST_METHOD'])) { + if (isset($argv)) { + foreach ($argv as $param) { $param = explode('=', $param); - if(count($param) > 1) - { + if (count($param) > 1) { $pname = strtoupper(ltrim($param[0], '-')); - $$pname=$param[1]; + $$pname = $param[1]; } } } - } - else - { + } else { // NB: we might as well consider using $_GET stuff later on... extract($_GET); extract($_POST); } - if(isset($DEBUG)) - { + if (isset($DEBUG)) { $args['DEBUG'] = intval($DEBUG); } - if(isset($LOCALSERVER)) - { + if (isset($LOCALSERVER)) { $args['LOCALSERVER'] = $LOCALSERVER; - } - else - { - if(isset($HTTP_HOST)) - { + } else { + if (isset($HTTP_HOST)) { $args['LOCALSERVER'] = $HTTP_HOST; - } - elseif(isset($_SERVER['HTTP_HOST'])) - { + } elseif (isset($_SERVER['HTTP_HOST'])) { $args['LOCALSERVER'] = $_SERVER['HTTP_HOST']; } } - if(isset($HTTPSSERVER)) - { + if (isset($HTTPSSERVER)) { $args['HTTPSSERVER'] = $HTTPSSERVER; } - if(isset($HTTPSURI)) - { + if (isset($HTTPSURI)) { $args['HTTPSURI'] = $HTTPSURI; } - if(isset($HTTPSIGNOREPEER)) - { - $args['HTTPSIGNOREPEER'] = bool($HTTPSIGNOREPEER); + if (isset($HTTPSIGNOREPEER)) { + $args['HTTPSIGNOREPEER'] = (bool)$HTTPSIGNOREPEER; + } + if (isset($HTTPSVERIFYHOST)) { + $args['HTTPSVERIFYHOST'] = (int)$HTTPSVERIFYHOST; } - if(isset($PROXY)) - { + if (isset($SSLVERSION)) { + $args['SSLVERSION'] = (int)$SSLVERSION; + } + if (isset($PROXY)) { $arr = explode(':', $PROXY); $args['PROXYSERVER'] = $arr[0]; - if(count($arr) > 1) - { + if (count($arr) > 1) { $args['PROXYPORT'] = $arr[1]; - } - else - { + } else { $args['PROXYPORT'] = 8080; } } // used to silence testsuite warnings about proxy code not being tested - if(isset($NOPROXY)) - { + if (isset($NOPROXY)) { $args['NOPROXY'] = true; } - if(!isset($URI)) - { + if (!isset($URI)) { // GUESTIMATE the url of local demo server // play nice to php 3 and 4-5 in retrieving URL of server.php /// @todo filter out query string from REQUEST_URI - if(isset($REQUEST_URI)) - { + if (isset($REQUEST_URI)) { $URI = str_replace('/tests/testsuite.php', '/demo/server/server.php', $REQUEST_URI); $URI = str_replace('/testsuite.php', '/server.php', $URI); $URI = str_replace('/tests/benchmark.php', '/demo/server/server.php', $URI); $URI = str_replace('/benchmark.php', '/server.php', $URI); - } - elseif(isset($_SERVER['PHP_SELF']) && isset($_SERVER['REQUEST_METHOD'])) - { + } elseif (isset($_SERVER['PHP_SELF']) && isset($_SERVER['REQUEST_METHOD'])) { $URI = str_replace('/tests/testsuite.php', '/demo/server/server.php', $_SERVER['PHP_SELF']); $URI = str_replace('/testsuite.php', '/server.php', $URI); $URI = str_replace('/tests/benchmark.php', '/demo/server/server.php', $URI); $URI = str_replace('/benchmark.php', '/server.php', $URI); - } - else - { + } else { $URI = '/demo/server/server.php'; } } - if($URI[0] != '/') - { - $URI = '/'.$URI; + if ($URI[0] != '/') { + $URI = '/' . $URI; } $args['URI'] = $URI; - if(isset($LOCALPATH)) - { - $args['LOCALPATH'] =$LOCALPATH; + if (isset($LOCALPATH)) { + $args['LOCALPATH'] = $LOCALPATH; } return $args; } - -} \ No newline at end of file +}