3 include_once __DIR__ . '/../lib/xmlrpc.inc';
4 include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
6 include_once __DIR__ . '/parse_args.php';
8 include_once __DIR__ . '/3LocalhostTest.php';
11 * Tests which stress http features of the library.
12 * Each of these tests iterates over (almost) all of the 'localhost' tests
14 class LocalhostMultiTest extends LocalhostTest
17 * @todo reintroduce skipping of tests which failed when executed individually if test runs happen as separate processes
18 * @todo reintroduce skipping of tests within the loop
22 $unsafeMethods = array('testHttps', 'testCatchExceptions', 'testUtf8Method', 'testServerComments', 'testExoticCharsetsRequests',
23 'testExoticCharsetsRequests2', 'testExoticCharsetsRequests3',
24 // @todo the following are currently not compatible w Digest Auth (most likely because of client copy) and should be fixed
25 'testcatchWarnings', 'testWrappedMethodAsSource', 'testTransferOfObjectViaWrapping');
26 foreach(get_class_methods('LocalhostTest') as $method)
28 if(strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods))
30 if (!isset(self::$failed_tests[$method]))
40 function testDeflate()
42 if(!function_exists('gzdeflate'))
44 $this->markTestSkipped('Zlib missing: cannot test deflate functionality');
47 $this->client->accepted_compression = array('deflate');
48 $this->client->request_compression = 'deflate';
54 if(!function_exists('gzdeflate'))
56 $this->markTestSkipped('Zlib missing: cannot test gzip functionality');
59 $this->client->accepted_compression = array('gzip');
60 $this->client->request_compression = 'gzip';
64 function testKeepAlives()
66 if(!function_exists('curl_init'))
68 $this->markTestSkipped('CURL missing: cannot test http 1.1');
71 $this->method = 'http11';
72 $this->client->keepalive = true;
78 if ($this->args['PROXYSERVER'])
80 $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
84 $this->markTestSkipped('PROXY definition missing: cannot test proxy');
89 if(!function_exists('curl_init'))
91 $this->markTestSkipped('CURL missing: cannot test http 1.1');
94 $this->method = 'http11'; // not an error the double assignment!
95 $this->client->method = 'http11';
96 //$this->client->verifyhost = 0;
97 //$this->client->verifypeer = 0;
98 $this->client->keepalive = false;
102 function testHttp11Gzip()
104 if(!function_exists('curl_init'))
106 $this->markTestSkipped('CURL missing: cannot test http 1.1');
109 $this->method = 'http11'; // not an error the double assignment!
110 $this->client->method = 'http11';
111 $this->client->keepalive = false;
112 $this->client->accepted_compression = array('gzip');
113 $this->client->request_compression = 'gzip';
117 function testHttp11Deflate()
119 if(!function_exists('curl_init'))
121 $this->markTestSkipped('CURL missing: cannot test http 1.1');
124 $this->method = 'http11'; // not an error the double assignment!
125 $this->client->method = 'http11';
126 $this->client->keepalive = false;
127 $this->client->accepted_compression = array('deflate');
128 $this->client->request_compression = 'deflate';
132 function testHttp11Proxy()
134 if(!function_exists('curl_init'))
136 $this->markTestSkipped('CURL missing: cannot test http 1.1 w. proxy');
139 else if ($this->args['PROXYSERVER'] == '')
141 $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1');
144 $this->method = 'http11'; // not an error the double assignment!
145 $this->client->method = 'http11';
146 $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
147 //$this->client->verifyhost = 0;
148 //$this->client->verifypeer = 0;
149 $this->client->keepalive = false;
155 if(!function_exists('curl_init'))
157 $this->markTestSkipped('CURL missing: cannot test https functionality');
160 $this->client->server = $this->args['HTTPSSERVER'];
161 $this->method = 'https';
162 $this->client->method = 'https';
163 $this->client->path = $this->args['HTTPSURI'];
164 $this->client->setSSLVerifyPeer(!$this->args['HTTPSIGNOREPEER']);
165 $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST']);
166 $this->client->setSSLVersion($this->args['SSLVERSION']);
170 function testHttpsProxy()
172 if(!function_exists('curl_init'))
174 $this->markTestSkipped('CURL missing: cannot test https functionality');
177 else if ($this->args['PROXYSERVER'] == '')
179 $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1');
182 $this->client->server = $this->args['HTTPSSERVER'];
183 $this->method = 'https';
184 $this->client->method = 'https';
185 $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
186 $this->client->path = $this->args['HTTPSURI'];
187 $this->client->setSSLVerifyPeer(!$this->args['HTTPSIGNOREPEER']);
188 $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST']);
189 $this->client->setSSLVersion($this->args['SSLVERSION']);
193 function testUTF8Responses()
195 //$this->client->path = strpos($URI, '?') === null ? $URI.'?RESPONSE_ENCODING=UTF-8' : $URI.'&RESPONSE_ENCODING=UTF-8';
196 $this->client->path = $this->args['URI'].'?RESPONSE_ENCODING=UTF-8';
200 function testUTF8Requests()
202 $this->client->request_charset_encoding = 'UTF-8';
206 function testISOResponses()
208 //$this->client->path = strpos($URI, '?') === null ? $URI.'?RESPONSE_ENCODING=UTF-8' : $URI.'&RESPONSE_ENCODING=UTF-8';
209 $this->client->path = $this->args['URI'].'?RESPONSE_ENCODING=ISO-8859-1';
213 function testISORequests()
215 $this->client->request_charset_encoding = 'ISO-8859-1';
219 function testBasicAuth()
221 $this->client->setCredentials('test', 'test');
222 $this->client->path = $this->args['URI'].'?FORCE_AUTH=Basic';
226 function testDigestAuth()
228 if (!function_exists('curl_init'))
230 $this->markTestSkipped('CURL missing: cannot test digest auth functionality');
233 $this->client->setCredentials('test', 'test', CURLAUTH_DIGEST);
234 $this->client->path = $this->args['URI'].'?FORCE_AUTH=Digest';
235 $this->method = 'http11';
236 $this->client->method = 'http11';