3 * Common parameter parsing for benchmarks and tests scripts
6 * @param string LOCALSERVER
8 * @param string HTTPSSERVER
9 * @param string HTTPSSURI
11 * @param string NOPROXY
13 * @copyright (C) 2007-20014 G. Giunta
14 * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt
19 static public function getArgs()
25 'LOCALSERVER' => 'localhost',
26 'HTTPSSERVER' => 'gggeek.ssl.altervista.org',
27 'HTTPSURI' => '/sw/xmlrpc/demo/server/server.php',
28 'HTTPSIGNOREPEER' => false,
29 'PROXYSERVER' => null,
31 'LOCALPATH' => __DIR__
34 // check for command line vs web page input params
35 if(!isset($_SERVER['REQUEST_METHOD']))
39 foreach($argv as $param)
41 $param = explode('=', $param);
44 $pname = strtoupper(ltrim($param[0], '-'));
52 // NB: we might as well consider using $_GET stuff later on...
59 $args['DEBUG'] = intval($DEBUG);
61 if(isset($LOCALSERVER))
63 $args['LOCALSERVER'] = $LOCALSERVER;
69 $args['LOCALSERVER'] = $HTTP_HOST;
71 elseif(isset($_SERVER['HTTP_HOST']))
73 $args['LOCALSERVER'] = $_SERVER['HTTP_HOST'];
76 if(isset($HTTPSSERVER))
78 $args['HTTPSSERVER'] = $HTTPSSERVER;
82 $args['HTTPSURI'] = $HTTPSURI;
84 if(isset($HTTPSIGNOREPEER))
86 $args['HTTPSIGNOREPEER'] = bool($HTTPSIGNOREPEER);
90 $arr = explode(':', $PROXY);
91 $args['PROXYSERVER'] = $arr[0];
94 $args['PROXYPORT'] = $arr[1];
98 $args['PROXYPORT'] = 8080;
101 // used to silence testsuite warnings about proxy code not being tested
104 $args['NOPROXY'] = true;
108 // GUESTIMATE the url of local demo server
109 // play nice to php 3 and 4-5 in retrieving URL of server.php
110 /// @todo filter out query string from REQUEST_URI
111 if(isset($REQUEST_URI))
113 $URI = str_replace('/tests/testsuite.php', '/demo/server/server.php', $REQUEST_URI);
114 $URI = str_replace('/testsuite.php', '/server.php', $URI);
115 $URI = str_replace('/tests/benchmark.php', '/demo/server/server.php', $URI);
116 $URI = str_replace('/benchmark.php', '/server.php', $URI);
118 elseif(isset($_SERVER['PHP_SELF']) && isset($_SERVER['REQUEST_METHOD']))
120 $URI = str_replace('/tests/testsuite.php', '/demo/server/server.php', $_SERVER['PHP_SELF']);
121 $URI = str_replace('/testsuite.php', '/server.php', $URI);
122 $URI = str_replace('/tests/benchmark.php', '/demo/server/server.php', $URI);
123 $URI = str_replace('/benchmark.php', '/server.php', $URI);
127 $URI = '/demo/server/server.php';
135 if(isset($LOCALPATH))
137 $args['LOCALPATH'] =$LOCALPATH;