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', 'testExoticCharsetsRequests2', 'testExoticCharsetsRequests3');
23 foreach(get_class_methods('LocalhostTest') as $method)
25 if(strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods))
27 if (!isset(self::$failed_tests[$method]))
37 function testDeflate()
39 if(!function_exists('gzdeflate'))
41 $this->markTestSkipped('Zlib missing: cannot test deflate functionality');
44 $this->client->accepted_compression = array('deflate');
45 $this->client->request_compression = 'deflate';
51 if(!function_exists('gzdeflate'))
53 $this->markTestSkipped('Zlib missing: cannot test gzip functionality');
56 $this->client->accepted_compression = array('gzip');
57 $this->client->request_compression = 'gzip';
61 function testKeepAlives()
63 if(!function_exists('curl_init'))
65 $this->markTestSkipped('CURL missing: cannot test http 1.1');
68 $this->method = 'http11';
69 $this->client->keepalive = true;
75 if ($this->args['PROXYSERVER'])
77 $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
81 $this->markTestSkipped('PROXY definition missing: cannot test proxy');
86 if(!function_exists('curl_init'))
88 $this->markTestSkipped('CURL missing: cannot test http 1.1');
91 $this->method = 'http11'; // not an error the double assignment!
92 $this->client->method = 'http11';
93 //$this->client->verifyhost = 0;
94 //$this->client->verifypeer = 0;
95 $this->client->keepalive = false;
99 function testHttp11Gzip()
101 if(!function_exists('curl_init'))
103 $this->markTestSkipped('CURL missing: cannot test http 1.1');
106 $this->method = 'http11'; // not an error the double assignment!
107 $this->client->method = 'http11';
108 $this->client->keepalive = false;
109 $this->client->accepted_compression = array('gzip');
110 $this->client->request_compression = 'gzip';
114 function testHttp11Deflate()
116 if(!function_exists('curl_init'))
118 $this->markTestSkipped('CURL missing: cannot test http 1.1');
121 $this->method = 'http11'; // not an error the double assignment!
122 $this->client->method = 'http11';
123 $this->client->keepalive = false;
124 $this->client->accepted_compression = array('deflate');
125 $this->client->request_compression = 'deflate';
129 function testHttp11Proxy()
131 if(!function_exists('curl_init'))
133 $this->markTestSkipped('CURL missing: cannot test http 1.1 w. proxy');
136 else if ($this->args['PROXYSERVER'] == '')
138 $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1');
141 $this->method = 'http11'; // not an error the double assignment!
142 $this->client->method = 'http11';
143 $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
144 //$this->client->verifyhost = 0;
145 //$this->client->verifypeer = 0;
146 $this->client->keepalive = false;
152 if(!function_exists('curl_init'))
154 $this->markTestSkipped('CURL missing: cannot test https functionality');
157 $this->client->server = $this->args['HTTPSSERVER'];
158 $this->method = 'https';
159 $this->client->method = 'https';
160 $this->client->path = $this->args['HTTPSURI'];
161 $this->client->setSSLVerifyPeer(!$this->args['HTTPSIGNOREPEER']);
162 $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST']);
163 $this->client->setSSLVersion($this->args['SSLVERSION']);
167 function testHttpsProxy()
169 if(!function_exists('curl_init'))
171 $this->markTestSkipped('CURL missing: cannot test https functionality');
174 else if ($this->args['PROXYSERVER'] == '')
176 $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1');
179 $this->client->server = $this->args['HTTPSSERVER'];
180 $this->method = 'https';
181 $this->client->method = 'https';
182 $this->client->setProxy($this->args['PROXYSERVER'], $this->args['PROXYPORT']);
183 $this->client->path = $this->args['HTTPSURI'];
184 $this->client->setSSLVerifyPeer(!$this->args['HTTPSIGNOREPEER']);
185 $this->client->setSSLVerifyHost($this->args['HTTPSVERIFYHOST']);
186 $this->client->setSSLVersion($this->args['SSLVERSION']);
190 function testUTF8Responses()
192 //$this->client->path = strpos($URI, '?') === null ? $URI.'?RESPONSE_ENCODING=UTF-8' : $URI.'&RESPONSE_ENCODING=UTF-8';
193 $this->client->path = $this->args['URI'].'?RESPONSE_ENCODING=UTF-8';
197 function testUTF8Requests()
199 $this->client->request_charset_encoding = 'UTF-8';
203 function testISOResponses()
205 //$this->client->path = strpos($URI, '?') === null ? $URI.'?RESPONSE_ENCODING=UTF-8' : $URI.'&RESPONSE_ENCODING=UTF-8';
206 $this->client->path = $this->args['URI'].'?RESPONSE_ENCODING=ISO-8859-1';
210 function testISORequests()
212 $this->client->request_charset_encoding = 'ISO-8859-1';