<?php
/**
- * Common parameter parsing for benchmarks and tests scripts.
+ * Common parameter parsing for benchmark and tests scripts.
*
* @param integer DEBUG
* @param string LOCALSERVER
* @param string HTTPSSURI
* @param string PROXY
* @param string NOPROXY
+ * @param bool HTTPSIGNOREPEER
+ * @param int HTTPSVERIFYHOST
+ * @param int SSLVERSION
*
- * @copyright (C) 2007-20014 G. Giunta
- * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt
+ * @copyright (C) 2007-2020 G. Giunta
+ * @license code licensed under the BSD License: see file license.txt
**/
class argParser
{
'HTTPSSERVER' => 'gggeek.ssl.altervista.org',
'HTTPSURI' => '/sw/xmlrpc/demo/server/server.php',
'HTTPSIGNOREPEER' => false,
+ 'HTTPSVERIFYHOST' => 2,
+ 'SSLVERSION' => 0,
'PROXYSERVER' => null,
'NOPROXY' => false,
'LOCALPATH' => __DIR__,
);
- // check for command line vs web page input params
+ // check for command line (env vars) vs. web page input params
if (!isset($_SERVER['REQUEST_METHOD'])) {
- if (isset($argv)) {
- foreach ($argv as $param) {
- $param = explode('=', $param);
- if (count($param) > 1) {
- $pname = strtoupper(ltrim($param[0], '-'));
- $$pname = $param[1];
- }
+ foreach($_SERVER as $key => $val) {
+ if (array_key_exists($key, $args)) {
+ $$key = $val;
}
}
} else {
$args['HTTPSURI'] = $HTTPSURI;
}
if (isset($HTTPSIGNOREPEER)) {
- $args['HTTPSIGNOREPEER'] = bool($HTTPSIGNOREPEER);
+ $args['HTTPSIGNOREPEER'] = (bool)$HTTPSIGNOREPEER;
+ }
+ if (isset($HTTPSVERIFYHOST)) {
+ $args['HTTPSVERIFYHOST'] = (int)$HTTPSVERIFYHOST;
+ }
+ if (isset($SSLVERSION)) {
+ $args['SSLVERSION'] = (int)$SSLVERSION;
}
if (isset($PROXY)) {
$arr = explode(':', $PROXY);