1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* \AppserverIo\Server\Configuration\ServerXmlConfiguration |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Johann Zelger <[email protected]> |
15
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/appserver-io/server |
18
|
|
|
* @link http://www.appserver.io |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace AppserverIo\Server\Configuration; |
22
|
|
|
|
23
|
|
|
use AppserverIo\Server\Utils\ServerUtil; |
24
|
|
|
use AppserverIo\Server\Interfaces\ServerConfigurationInterface; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Server configuration that handles XML files. |
28
|
|
|
* |
29
|
|
|
* @author Johann Zelger <[email protected]> |
30
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
31
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
32
|
|
|
* @link https://github.com/appserver-io/server |
33
|
|
|
* @link http://www.appserver.io |
34
|
|
|
*/ |
35
|
|
|
class ServerXmlConfiguration implements ServerConfigurationInterface |
36
|
|
|
{ |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* The configured rewrite rules |
40
|
|
|
* |
41
|
|
|
* @var array |
42
|
|
|
*/ |
43
|
|
|
protected $rewrites = array(); |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* The configured locations. |
47
|
|
|
* |
48
|
|
|
* @var array |
49
|
|
|
*/ |
50
|
|
|
protected $locations = array(); |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* The configured headers |
54
|
|
|
* |
55
|
|
|
* @var array |
56
|
|
|
*/ |
57
|
|
|
protected $headers = array(); |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Holds the environmentVariables array |
61
|
|
|
* |
62
|
|
|
* @var array |
63
|
|
|
*/ |
64
|
|
|
protected $environmentVariables = array(); |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* The server name for internal purposes. |
68
|
|
|
* |
69
|
|
|
* @var string |
70
|
|
|
*/ |
71
|
|
|
protected $name = 'httpsServer'; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* The server class name. |
75
|
|
|
* |
76
|
|
|
* @var string |
77
|
|
|
*/ |
78
|
|
|
protected $type = '\\AppserverIo\\Server\\Servers\\MultiThreadedServer'; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* The worker class name. |
82
|
|
|
* |
83
|
|
|
* @var string |
84
|
|
|
*/ |
85
|
|
|
protected $workerType = '\\AppserverIo\\Server\\Workers\\ThreadWorker'; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* The socket class name. |
89
|
|
|
* |
90
|
|
|
* @var string |
91
|
|
|
*/ |
92
|
|
|
protected $socketType = '\\AppserverIo\\Server\\Sockets\\StreamSocket'; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* The stream context class name. |
96
|
|
|
* |
97
|
|
|
* @var string |
98
|
|
|
*/ |
99
|
|
|
protected $streamContextType = '\\AppserverIo\\Server\\Contexts\\StreamContext'; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* The server context class name. |
103
|
|
|
* |
104
|
|
|
* @var string |
105
|
|
|
*/ |
106
|
|
|
protected $serverContextType = '\\AppserverIo\\Server\\Contexts\\ServerContext'; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* The request context class name. |
110
|
|
|
* |
111
|
|
|
* @var string |
112
|
|
|
*/ |
113
|
|
|
protected $requestContextType = '\\AppserverIo\\Server\\Contexts\\RequestContext'; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* The logger name for internal purposes. |
117
|
|
|
* |
118
|
|
|
* @var string |
119
|
|
|
*/ |
120
|
|
|
protected $loggerName = 'System'; |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* The server admin's email addres. |
124
|
|
|
* |
125
|
|
|
* @var string |
126
|
|
|
*/ |
127
|
|
|
protected $admin = '[email protected]'; |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* The server software name. |
131
|
|
|
* |
132
|
|
|
* @var string |
133
|
|
|
*/ |
134
|
|
|
protected $software = 'phpWebServer/7.0.0'; |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* The number of workers to start. |
138
|
|
|
* |
139
|
|
|
* @var integer |
140
|
|
|
*/ |
141
|
|
|
protected $workerNumber = 64; |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* The minimum number of requests a worker handles. |
145
|
|
|
* |
146
|
|
|
* @var integer |
147
|
|
|
*/ |
148
|
|
|
protected $workerAcceptMin = 16; |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* The maximum number of requests a worker handles. |
152
|
|
|
* |
153
|
|
|
* @var integer |
154
|
|
|
*/ |
155
|
|
|
protected $workerAcceptMax = 64; |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* The transport protocol to use. |
159
|
|
|
* |
160
|
|
|
* @var string |
161
|
|
|
*/ |
162
|
|
|
protected $transport = 'tcp'; |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* The IP address to use. |
166
|
|
|
* |
167
|
|
|
* @var string |
168
|
|
|
*/ |
169
|
|
|
protected $address = '0.0.0.0'; |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* The port to use. |
173
|
|
|
* |
174
|
|
|
* @var string |
175
|
|
|
*/ |
176
|
|
|
protected $port = 9080; |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* Socket flags used for socket initialization. |
180
|
|
|
* |
181
|
|
|
* @var string |
182
|
|
|
*/ |
183
|
|
|
protected $flags = null; |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* The server's document root. |
187
|
|
|
* |
188
|
|
|
* @var string |
189
|
|
|
*/ |
190
|
|
|
protected $documentRoot = 'var/www'; |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* Directory index files to be used. |
194
|
|
|
* |
195
|
|
|
* @var string |
196
|
|
|
*/ |
197
|
|
|
protected $directoryIndex = 'index.php index.html index.htm'; |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* The maximum requests to be handled for a keep alive connection. |
201
|
|
|
* |
202
|
|
|
* @var integer |
203
|
|
|
*/ |
204
|
|
|
protected $keepAliveMax = 64; |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* The timeout for the keep alive connection. |
208
|
|
|
* |
209
|
|
|
* @var integer |
210
|
|
|
*/ |
211
|
|
|
protected $keepAliveTimeout = 5; |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* Flag to enable/disable auto index functionality. |
215
|
|
|
* |
216
|
|
|
* @var boolean |
217
|
|
|
*/ |
218
|
|
|
protected $autoIndex = false; |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* The path to the error page template. |
222
|
|
|
* |
223
|
|
|
* @var string |
224
|
|
|
*/ |
225
|
|
|
protected $errorsPageTemplatePath = 'resources/templates/www/error.phtml'; |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* The path to the welcome page template. |
229
|
|
|
* |
230
|
|
|
* @var string |
231
|
|
|
*/ |
232
|
|
|
protected $welcomePageTemplatePath = 'resources/templates/www/welcome.phtml'; |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* The path to the auto index template. |
236
|
|
|
* |
237
|
|
|
* @var string |
238
|
|
|
*/ |
239
|
|
|
protected $autoIndexTemplatePath = 'resources/templates/www/auto_index.phtml'; |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* The path to the SSL certificate. |
243
|
|
|
* |
244
|
|
|
* @var string |
245
|
|
|
*/ |
246
|
|
|
protected $certPath = 'etc/webserver.pem'; |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* The path to the SSL certificate's private key file. |
250
|
|
|
* |
251
|
|
|
* @var string |
252
|
|
|
*/ |
253
|
|
|
protected $privateKeyPath = null; |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* The path to the Diffie Hellmann param file. |
257
|
|
|
* |
258
|
|
|
* @var string |
259
|
|
|
*/ |
260
|
|
|
protected $dhParamPath = null; |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* The SSL certificate's passphrase. |
264
|
|
|
* |
265
|
|
|
* @var string |
266
|
|
|
*/ |
267
|
|
|
protected $passphrase = null; |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* The crypto method(s) to use. |
271
|
|
|
* |
272
|
|
|
* @var string |
273
|
|
|
*/ |
274
|
|
|
protected $cryptoMethod = 'STREAM_CRYPTO_METHOD_TLS_SERVER'; |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* The peer name. |
278
|
|
|
* |
279
|
|
|
* @var string |
280
|
|
|
*/ |
281
|
|
|
protected $peerName = null; |
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* Flag to enable/disable peer verification. |
285
|
|
|
* |
286
|
|
|
* @var boolean |
287
|
|
|
*/ |
288
|
|
|
protected $verifyPeer = false; |
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* The flag to enable/disable peer name verification. |
292
|
|
|
* |
293
|
|
|
* @var boolean |
294
|
|
|
*/ |
295
|
|
|
protected $verifyPeerName = false; |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* Flag to allow/disallow self signed SSL certificates. |
299
|
|
|
* |
300
|
|
|
* @var boolean |
301
|
|
|
*/ |
302
|
|
|
protected $allowSelfSigned = true; |
303
|
|
|
|
304
|
|
|
/** |
305
|
|
|
* The flag to disable TLS compression. This can help mitigate the CRIME attack vector. |
306
|
|
|
* |
307
|
|
|
* @var boolean |
308
|
|
|
*/ |
309
|
|
|
protected $disableCompression = true; |
310
|
|
|
|
311
|
|
|
/** |
312
|
|
|
* The flag to control cipher ordering preferences during negotiation has to be allowed. |
313
|
|
|
* |
314
|
|
|
* @var boolean |
315
|
|
|
*/ |
316
|
|
|
protected $honorCipherOrder = true; |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* The curve to use with ECDH ciphers, if not specified prime256v1 will be used. |
320
|
|
|
* |
321
|
|
|
* @var string |
322
|
|
|
*/ |
323
|
|
|
protected $ecdhCurve = 'prime256v1'; |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* The flag to enable/disable new key pair has to be created in scenarios where ECDH cipher suites are negotiated (instead of the preferred ECDHE ciphers). |
327
|
|
|
* @var boolean |
328
|
|
|
*/ |
329
|
|
|
protected $singleEcdhUse = true; |
330
|
|
|
|
331
|
|
|
/** |
332
|
|
|
* The flag to enable/disable new key pair creation when using DH parameters (improves forward secrecy). |
333
|
|
|
* |
334
|
|
|
* @var boolean |
335
|
|
|
*/ |
336
|
|
|
protected $singleDhUse = true; |
337
|
|
|
|
338
|
|
|
/** |
339
|
|
|
* The list of available ciphers. |
340
|
|
|
* |
341
|
|
|
* @var string |
342
|
|
|
* @link http://php.net/manual/en/context.ssl.php#context.ssl.ciphers |
343
|
|
|
* @link https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER_LIST_FORMAT |
344
|
|
|
*/ |
345
|
|
|
protected $ciphers = 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK'; |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* Constructs config |
349
|
|
|
* |
350
|
|
|
* @param \SimpleXMLElement $node The simple xml element used to build config |
351
|
|
|
*/ |
352
|
|
|
public function __construct($node) |
353
|
|
|
{ |
354
|
|
|
|
355
|
|
|
// load the object properties |
356
|
|
|
$properties = get_object_vars($this); |
357
|
|
|
|
358
|
|
|
// prepare properties |
359
|
|
|
$this->name = (string) $node->attributes()->name; |
360
|
|
|
$this->type = (string) $node->attributes()->type; |
361
|
|
|
$this->workerType = (string) $node->attributes()->worker; |
362
|
|
|
$this->socketType = (string) $node->attributes()->socket; |
363
|
|
|
$this->streamContextType = (string) $node->attributes()->streamContext; |
364
|
|
|
$this->serverContextType = (string) $node->attributes()->serverContext; |
365
|
|
|
$this->requestContextType = (string) $node->attributes()->requestContext; |
366
|
|
|
$this->loggerName = (string) $node->attributes()->loggerName; |
367
|
|
|
|
368
|
|
|
// extract the properties from the params |
369
|
|
|
foreach ($node->xpath('./params/param') as $param) { |
370
|
|
|
if (array_key_exists($propertyName = (string) $param->attributes()->name, $properties)) { |
371
|
|
|
$this->{$propertyName} = ServerUtil::singleton()->castToType($param->attributes()->type, (string) $param); |
372
|
|
|
} |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
// prepare analytics |
376
|
|
|
$this->analytics = $this->prepareAnalytics($node); |
|
|
|
|
377
|
|
|
// prepare modules |
378
|
|
|
$this->headers = $this->prepareHeaders($node); |
379
|
|
|
// prepare modules |
380
|
|
|
$this->modules = $this->prepareModules($node); |
|
|
|
|
381
|
|
|
// prepare connection handlers |
382
|
|
|
$this->connectionHandlers = $this->prepareConnectionHandlers($node); |
|
|
|
|
383
|
|
|
// prepare handlers |
384
|
|
|
$this->handlers = $this->prepareHandlers($node); |
|
|
|
|
385
|
|
|
// prepare virutalHosts |
386
|
|
|
$this->virtualHosts = $this->prepareVirtualHosts($node); |
|
|
|
|
387
|
|
|
// prepare rewrites |
388
|
|
|
$this->rewrites = $this->prepareRewrites($node); |
389
|
|
|
// prepare environmentVariables |
390
|
|
|
$this->environmentVariables = $this->prepareEnvironmentVariables($node); |
391
|
|
|
// prepare authentications |
392
|
|
|
$this->authentications = $this->prepareAuthentications($node); |
|
|
|
|
393
|
|
|
// prepare accesses |
394
|
|
|
$this->accesses = $this->prepareAccesses($node); |
|
|
|
|
395
|
|
|
// prepare locations |
396
|
|
|
$this->locations = $this->prepareLocations($node); |
397
|
|
|
// prepare rewrite maps |
398
|
|
|
$this->rewriteMaps = $this->prepareRewriteMaps($node); |
|
|
|
|
399
|
|
|
// prepare certificates |
400
|
|
|
$this->certificates = $this->prepareCertificates($node); |
|
|
|
|
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
/** |
404
|
|
|
* Prepares the headers array based on a simple xml element node |
405
|
|
|
* |
406
|
|
|
* @param \SimpleXMLElement $node The xml node |
407
|
|
|
* |
408
|
|
|
* @return array |
409
|
|
|
*/ |
410
|
|
|
public function prepareHeaders(\SimpleXMLElement $node) |
411
|
|
|
{ |
412
|
|
|
$headers = array(); |
413
|
|
|
if ($node->headers) { |
414
|
|
|
foreach ($node->headers->header as $headerNode) { |
415
|
|
|
// Cut of the SimpleXML attributes wrapper and attach it to our headers |
416
|
|
|
$override = false; |
417
|
|
|
$overrideAttribute = strtolower((string)$headerNode->attributes()->override); |
418
|
|
|
if ($overrideAttribute && $overrideAttribute === 'true') { |
419
|
|
|
$override = true; |
420
|
|
|
} |
421
|
|
|
$append = false; |
422
|
|
|
$appendAttribute = strtolower((string)$headerNode->attributes()->append); |
423
|
|
|
if ($appendAttribute && $appendAttribute === 'true') { |
424
|
|
|
$append = true; |
425
|
|
|
} |
426
|
|
|
$header = array( |
427
|
|
|
'type' => (string) $headerNode->attributes()->type, |
428
|
|
|
'name' => (string) $headerNode->attributes()->name, |
429
|
|
|
'value' => (string) $headerNode->attributes()->value, |
430
|
|
|
'uri' => (string) $headerNode->attributes()->uri, |
431
|
|
|
'override' => $override, |
432
|
|
|
'append' => $append |
433
|
|
|
); |
434
|
|
|
$headers[(string) $headerNode->attributes()->type][] = $header; |
435
|
|
|
} |
436
|
|
|
} |
437
|
|
|
return $headers; |
438
|
|
|
} |
439
|
|
|
|
440
|
|
|
/** |
441
|
|
|
* Prepares the modules array based on a simple xml element node |
442
|
|
|
* |
443
|
|
|
* @param \SimpleXMLElement $node The xml node |
444
|
|
|
* |
445
|
|
|
* @return array |
446
|
|
|
*/ |
447
|
|
|
public function prepareModules(\SimpleXMLElement $node) |
448
|
|
|
{ |
449
|
|
|
$modules = array(); |
450
|
|
|
if ($node->modules) { |
451
|
|
|
foreach ($node->modules->module as $moduleNode) { |
452
|
|
|
$modules[] = new ModuleXmlConfiguration($moduleNode); |
453
|
|
|
} |
454
|
|
|
} |
455
|
|
|
return $modules; |
456
|
|
|
} |
457
|
|
|
|
458
|
|
|
/** |
459
|
|
|
* Prepares the connectionHandlers array based on a simple xml element node |
460
|
|
|
* |
461
|
|
|
* @param \SimpleXMLElement $node The xml node |
462
|
|
|
* |
463
|
|
|
* @return array |
464
|
|
|
*/ |
465
|
|
|
public function prepareConnectionHandlers(\SimpleXMLElement $node) |
466
|
|
|
{ |
467
|
|
|
$connectionHandlers = array(); |
468
|
|
|
if ($node->connectionHandlers) { |
469
|
|
|
foreach ($node->connectionHandlers->connectionHandler as $connectionHandlerNode) { |
470
|
|
|
$connectionHandlerType = (string) $connectionHandlerNode->attributes()->type; |
471
|
|
|
$connectionHandlers[] = $connectionHandlerType; |
472
|
|
|
} |
473
|
|
|
} |
474
|
|
|
return $connectionHandlers; |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
/** |
478
|
|
|
* Prepares the handlers array based on a simple xml element node |
479
|
|
|
* |
480
|
|
|
* @param \SimpleXMLElement $node The xml node |
481
|
|
|
* |
482
|
|
|
* @return array |
483
|
|
|
*/ |
484
|
|
|
public function prepareHandlers(\SimpleXMLElement $node) |
485
|
|
|
{ |
486
|
|
|
$handlers = array(); |
487
|
|
|
if ($node->handlers) { |
488
|
|
View Code Duplication |
foreach ($node->handlers->handler as $handlerNode) { |
|
|
|
|
489
|
|
|
$params = array(); |
490
|
|
|
if ($handlerNode->params->param) { |
491
|
|
|
foreach ($handlerNode->params->param as $paramNode) { |
492
|
|
|
$paramName = (string)$paramNode->attributes()->name; |
493
|
|
|
$paramNodes = $handlerNode->xpath(".//param[@name='$paramName']"); |
494
|
|
|
$params[$paramName] = (string) array_shift($paramNodes); |
495
|
|
|
} |
496
|
|
|
} |
497
|
|
|
$handlers[(string)$handlerNode->attributes()->extension] = array( |
498
|
|
|
'name' => (string) $handlerNode->attributes()->name, |
499
|
|
|
'params' => $params |
500
|
|
|
); |
501
|
|
|
} |
502
|
|
|
} |
503
|
|
|
return $handlers; |
504
|
|
|
} |
505
|
|
|
|
506
|
|
|
/** |
507
|
|
|
* Prepares the virtual hosts array based on a simple xml element node |
508
|
|
|
* |
509
|
|
|
* @param \SimpleXMLElement $node The xml node |
510
|
|
|
* |
511
|
|
|
* @return array |
512
|
|
|
*/ |
513
|
|
|
public function prepareVirtualHosts(\SimpleXMLElement $node) |
514
|
|
|
{ |
515
|
|
|
$virutalHosts = array(); |
516
|
|
|
if ($node->virtualHosts) { |
517
|
|
|
foreach ($node->virtualHosts->virtualHost as $virtualHostNode) { |
518
|
|
|
$virtualHostNames = explode(' ', (string)$virtualHostNode->attributes()->name); |
519
|
|
|
$params = array(); |
520
|
|
|
foreach ($virtualHostNode->params->param as $paramNode) { |
521
|
|
|
$paramName = (string) $paramNode->attributes()->name; |
522
|
|
|
$paramNodes = $virtualHostNode->xpath(".//param[@name='$paramName']"); |
523
|
|
|
$params[$paramName] = (string) array_shift($paramNodes); |
524
|
|
|
} |
525
|
|
View Code Duplication |
foreach ($virtualHostNames as $virtualHostName) { |
|
|
|
|
526
|
|
|
// set all virtual hosts params per key for faster matching later on |
527
|
|
|
$virutalHosts[trim($virtualHostName)] = array( |
528
|
|
|
'params' => $params, |
529
|
|
|
'headers' => $this->prepareHeaders($virtualHostNode), |
530
|
|
|
'rewriteMaps' => $this->prepareRewriteMaps($virtualHostNode), |
531
|
|
|
'rewrites' => $this->prepareRewrites($virtualHostNode), |
532
|
|
|
'locations' => $this->prepareLocations($virtualHostNode), |
533
|
|
|
'environmentVariables' => $this->prepareEnvironmentVariables($virtualHostNode), |
534
|
|
|
'authentications' => $this->prepareAuthentications($virtualHostNode), |
535
|
|
|
'accesses' => $this->prepareAccesses($virtualHostNode), |
536
|
|
|
'analytics' => $this->prepareAnalytics($virtualHostNode) |
537
|
|
|
); |
538
|
|
|
} |
539
|
|
|
} |
540
|
|
|
} |
541
|
|
|
return $virutalHosts; |
542
|
|
|
} |
543
|
|
|
|
544
|
|
|
/** |
545
|
|
|
* Prepares the rewrite maps based on a simple xml element node |
546
|
|
|
* |
547
|
|
|
* @param \SimpleXMLElement $node The xml node |
548
|
|
|
* |
549
|
|
|
* @return array |
550
|
|
|
*/ |
551
|
|
View Code Duplication |
public function prepareRewriteMaps(\SimpleXMLElement $node) |
|
|
|
|
552
|
|
|
{ |
553
|
|
|
$rewriteMaps = array(); |
554
|
|
|
if ($node->rewriteMaps) { |
555
|
|
|
foreach ($node->rewriteMaps->rewriteMap as $rewriteMapNode) { |
556
|
|
|
$rewriteMapType = (string)$rewriteMapNode->attributes()->type; |
557
|
|
|
$params = array(); |
558
|
|
|
foreach ($rewriteMapNode->params->param as $paramNode) { |
559
|
|
|
$paramName = (string) $paramNode->attributes()->name; |
560
|
|
|
$paramNodes = $rewriteMapNode->xpath(".//param[@name='$paramName']"); |
561
|
|
|
$params[$paramName] = (string) array_shift($paramNodes); |
562
|
|
|
} |
563
|
|
|
$rewriteMaps[$rewriteMapType] = $params; |
564
|
|
|
} |
565
|
|
|
} |
566
|
|
|
return $rewriteMaps; |
567
|
|
|
} |
568
|
|
|
|
569
|
|
|
/** |
570
|
|
|
* Prepares the rewrites array based on a simple xml element node |
571
|
|
|
* |
572
|
|
|
* @param \SimpleXMLElement $node The xml node |
573
|
|
|
* |
574
|
|
|
* @return array |
575
|
|
|
*/ |
576
|
|
|
public function prepareRewrites(\SimpleXMLElement $node) |
577
|
|
|
{ |
578
|
|
|
$rewrites = array(); |
579
|
|
|
if ($node->rewrites) { |
580
|
|
|
foreach ($node->rewrites->rewrite as $rewriteNode) { |
581
|
|
|
// cut of the SimpleXML attributes wrapper and attach it to our rewrites |
582
|
|
|
$rewrite = (array)$rewriteNode; |
583
|
|
|
$rewrites[] = array_shift($rewrite); |
584
|
|
|
} |
585
|
|
|
} |
586
|
|
|
return $rewrites; |
587
|
|
|
} |
588
|
|
|
|
589
|
|
|
/** |
590
|
|
|
* Prepares the certificates array based on a simple xml element node |
591
|
|
|
* |
592
|
|
|
* @param \SimpleXMLElement $node The xml node |
593
|
|
|
* |
594
|
|
|
* @return array |
595
|
|
|
*/ |
596
|
|
|
public function prepareCertificates(\SimpleXMLElement $node) |
597
|
|
|
{ |
598
|
|
|
$certificates = array(); |
599
|
|
|
if ($node->certificates) { |
600
|
|
|
foreach ($node->certificates->certificate as $certificateNode) { |
601
|
|
|
// Cut of the SimpleXML attributes wrapper and attach it to our locations |
602
|
|
|
$certificate = array( |
603
|
|
|
'domain' => (string) $certificateNode->attributes()->domain, |
604
|
|
|
'certPath' => (string) $certificateNode->attributes()->certPath |
605
|
|
|
); |
606
|
|
|
$certificates[] = $certificate; |
607
|
|
|
} |
608
|
|
|
} |
609
|
|
|
return $certificates; |
610
|
|
|
} |
611
|
|
|
|
612
|
|
|
/** |
613
|
|
|
* Prepares the locations array based on a simple xml element node |
614
|
|
|
* |
615
|
|
|
* @param \SimpleXMLElement $node The xml node |
616
|
|
|
* |
617
|
|
|
* @return array |
618
|
|
|
*/ |
619
|
|
|
public function prepareLocations(\SimpleXMLElement $node) |
620
|
|
|
{ |
621
|
|
|
$locations = array(); |
622
|
|
|
if ($node->locations) { |
623
|
|
|
foreach ($node->locations->location as $locationNode) { |
624
|
|
|
// Cut of the SimpleXML attributes wrapper and attach it to our locations |
625
|
|
|
$location = array( |
626
|
|
|
'condition' => (string) $locationNode->attributes()->condition, |
627
|
|
|
'handlers' => $this->prepareHandlers($locationNode), |
628
|
|
|
'headers' => $this->prepareHeaders($locationNode), |
629
|
|
|
); |
630
|
|
|
$locations[] = $location; |
631
|
|
|
} |
632
|
|
|
} |
633
|
|
|
return $locations; |
634
|
|
|
} |
635
|
|
|
|
636
|
|
|
/** |
637
|
|
|
* Prepares the environmentVariables array based on a simple xml element node |
638
|
|
|
* |
639
|
|
|
* @param \SimpleXMLElement $node The xml node |
640
|
|
|
* |
641
|
|
|
* @return array |
642
|
|
|
*/ |
643
|
|
|
public function prepareEnvironmentVariables(\SimpleXMLElement $node) |
644
|
|
|
{ |
645
|
|
|
$environmentVariables = array(); |
646
|
|
|
if ($node->environmentVariables) { |
647
|
|
|
foreach ($node->environmentVariables->environmentVariable as $environmentVariableNode) { |
648
|
|
|
// cut of the SimpleXML attributes wrapper and attach it to our environment variable |
649
|
|
|
$environmentVariable = (array) $environmentVariableNode; |
650
|
|
|
$environmentVariables[] = array_shift($environmentVariable); |
651
|
|
|
} |
652
|
|
|
} |
653
|
|
|
return $environmentVariables; |
654
|
|
|
} |
655
|
|
|
|
656
|
|
|
/** |
657
|
|
|
* Prepares the authentications array based on a simple xml element node |
658
|
|
|
* |
659
|
|
|
* @param \SimpleXMLElement $node The xml node |
660
|
|
|
* |
661
|
|
|
* @return array |
662
|
|
|
*/ |
663
|
|
View Code Duplication |
public function prepareAuthentications(\SimpleXMLElement $node) |
|
|
|
|
664
|
|
|
{ |
665
|
|
|
$authentications = array(); |
666
|
|
|
if ($node->authentications) { |
667
|
|
|
foreach ($node->authentications->authentication as $authenticationNode) { |
668
|
|
|
$params = array(); |
669
|
|
|
foreach ($authenticationNode->params->param as $paramNode) { |
670
|
|
|
$paramName = (string) $paramNode->attributes()->name; |
671
|
|
|
$paramNodes = $authenticationNode->xpath(".//param[@name='$paramName']"); |
672
|
|
|
$params[$paramName] = (string) array_shift($paramNodes); |
673
|
|
|
} |
674
|
|
|
$authentications[(string)$authenticationNode->attributes()->uri] = $params; |
675
|
|
|
} |
676
|
|
|
} |
677
|
|
|
return $authentications; |
678
|
|
|
} |
679
|
|
|
|
680
|
|
|
/** |
681
|
|
|
* Prepares the access array based on a simple xml element node |
682
|
|
|
* |
683
|
|
|
* @param \SimpleXMLElement $node The xml node |
684
|
|
|
* |
685
|
|
|
* @return array |
686
|
|
|
*/ |
687
|
|
View Code Duplication |
public function prepareAccesses(\SimpleXMLElement $node) |
|
|
|
|
688
|
|
|
{ |
689
|
|
|
// init accesses |
690
|
|
|
$accesses = array(); |
691
|
|
|
if ($node->accesses) { |
692
|
|
|
foreach ($node->accesses->access as $accessNode) { |
693
|
|
|
$params = array(); |
694
|
|
|
foreach ($accessNode->params->param as $paramNode) { |
695
|
|
|
$paramName = (string)$paramNode->attributes()->name; |
696
|
|
|
$paramNodes = $accessNode->xpath(".//param[@name='$paramName']"); |
697
|
|
|
$params[$paramName] = (string) array_shift($paramNodes); |
698
|
|
|
} |
699
|
|
|
$accesses[(string) $accessNode->attributes()->type][] = $params; |
700
|
|
|
} |
701
|
|
|
} |
702
|
|
|
return $accesses; |
703
|
|
|
} |
704
|
|
|
|
705
|
|
|
/** |
706
|
|
|
* Prepares the analytics array based on a simple XML element node |
707
|
|
|
* |
708
|
|
|
* @param \SimpleXMLElement $node The XML node |
709
|
|
|
* |
710
|
|
|
* @return array |
711
|
|
|
*/ |
712
|
|
|
public function prepareAnalytics(\SimpleXMLElement $node) |
713
|
|
|
{ |
714
|
|
|
$analytics = array(); |
715
|
|
|
if ($node->analytics) { |
716
|
|
|
foreach ($node->analytics->analytic as $analyticNode) { |
717
|
|
|
$connectors = array(); |
718
|
|
View Code Duplication |
foreach ($analyticNode->connectors->connector as $connectorNode) { |
|
|
|
|
719
|
|
|
// connectors might have params |
720
|
|
|
$params = array(); |
721
|
|
|
if ($connectorNode->params) { |
722
|
|
|
foreach ($connectorNode->params->param as $paramNode) { |
723
|
|
|
$paramName = (string) $paramNode->attributes()->name; |
724
|
|
|
$paramNodes = $connectorNode->xpath(".//param[@name='$paramName']"); |
725
|
|
|
$params[$paramName] = (string) array_shift($paramNodes); |
726
|
|
|
} |
727
|
|
|
} |
728
|
|
|
|
729
|
|
|
// build up the connectors entry |
730
|
|
|
$connectors[] = array( |
731
|
|
|
'name' => (string)$connectorNode->attributes()->name, |
732
|
|
|
'type' => (string)$connectorNode->attributes()->type, |
733
|
|
|
'params' => $params |
734
|
|
|
); |
735
|
|
|
} |
736
|
|
|
|
737
|
|
|
// build up the analytics entry |
738
|
|
|
$analytics[] = array( |
739
|
|
|
'uri' => (string)$analyticNode->attributes()->uri, |
740
|
|
|
'connectors' => $connectors |
741
|
|
|
); |
742
|
|
|
} |
743
|
|
|
} |
744
|
|
|
return $analytics; |
745
|
|
|
} |
746
|
|
|
|
747
|
|
|
/** |
748
|
|
|
* Return's name |
749
|
|
|
* |
750
|
|
|
* @return string |
751
|
|
|
*/ |
752
|
|
|
public function getName() |
753
|
|
|
{ |
754
|
|
|
return $this->name; |
755
|
|
|
} |
756
|
|
|
|
757
|
|
|
/** |
758
|
|
|
* Return's type |
759
|
|
|
* |
760
|
|
|
* @return string |
761
|
|
|
*/ |
762
|
|
|
public function getType() |
763
|
|
|
{ |
764
|
|
|
return $this->type; |
765
|
|
|
} |
766
|
|
|
|
767
|
|
|
/** |
768
|
|
|
* Return's logger name |
769
|
|
|
* |
770
|
|
|
* @return string |
771
|
|
|
*/ |
772
|
|
|
public function getLoggerName() |
773
|
|
|
{ |
774
|
|
|
return $this->loggerName; |
775
|
|
|
} |
776
|
|
|
|
777
|
|
|
/** |
778
|
|
|
* Return's transport |
779
|
|
|
* |
780
|
|
|
* @return string |
781
|
|
|
*/ |
782
|
|
|
public function getTransport() |
783
|
|
|
{ |
784
|
|
|
return $this->transport; |
785
|
|
|
} |
786
|
|
|
|
787
|
|
|
/** |
788
|
|
|
* Returns rewrites |
789
|
|
|
* |
790
|
|
|
* @return array |
791
|
|
|
*/ |
792
|
|
|
public function getRewrites() |
793
|
|
|
{ |
794
|
|
|
return $this->rewrites; |
795
|
|
|
} |
796
|
|
|
|
797
|
|
|
/** |
798
|
|
|
* Return's address |
799
|
|
|
* |
800
|
|
|
* @return string |
801
|
|
|
*/ |
802
|
|
|
public function getAddress() |
803
|
|
|
{ |
804
|
|
|
return $this->address; |
805
|
|
|
} |
806
|
|
|
|
807
|
|
|
/** |
808
|
|
|
* Return's port |
809
|
|
|
* |
810
|
|
|
* @return int |
811
|
|
|
*/ |
812
|
|
|
public function getPort() |
813
|
|
|
{ |
814
|
|
|
return (int)$this->port; |
815
|
|
|
} |
816
|
|
|
|
817
|
|
|
/** |
818
|
|
|
* Return's flags |
819
|
|
|
* |
820
|
|
|
* @return string |
821
|
|
|
*/ |
822
|
|
|
public function getFlags() |
823
|
|
|
{ |
824
|
|
|
return $this->flags; |
825
|
|
|
} |
826
|
|
|
|
827
|
|
|
/** |
828
|
|
|
* Return's software |
829
|
|
|
* |
830
|
|
|
* @return string |
831
|
|
|
*/ |
832
|
|
|
public function getSoftware() |
833
|
|
|
{ |
834
|
|
|
return $this->software; |
835
|
|
|
} |
836
|
|
|
|
837
|
|
|
/** |
838
|
|
|
* Return's admin |
839
|
|
|
* |
840
|
|
|
* @return string |
841
|
|
|
*/ |
842
|
|
|
public function getAdmin() |
843
|
|
|
{ |
844
|
|
|
return $this->admin; |
845
|
|
|
} |
846
|
|
|
|
847
|
|
|
/** |
848
|
|
|
* Return's analytics |
849
|
|
|
* |
850
|
|
|
* @return string |
851
|
|
|
*/ |
852
|
|
|
public function getAnalytics() |
853
|
|
|
{ |
854
|
|
|
return $this->analytics; |
855
|
|
|
} |
856
|
|
|
|
857
|
|
|
/** |
858
|
|
|
* Return's keep-alive max connection |
859
|
|
|
* |
860
|
|
|
* @return int |
861
|
|
|
*/ |
862
|
|
|
public function getKeepAliveMax() |
863
|
|
|
{ |
864
|
|
|
return (int)$this->keepAliveMax; |
865
|
|
|
} |
866
|
|
|
|
867
|
|
|
/** |
868
|
|
|
* Return's keep-alive timeout |
869
|
|
|
* |
870
|
|
|
* @return int |
871
|
|
|
*/ |
872
|
|
|
public function getKeepAliveTimeout() |
873
|
|
|
{ |
874
|
|
|
return (int)$this->keepAliveTimeout; |
875
|
|
|
} |
876
|
|
|
|
877
|
|
|
/** |
878
|
|
|
* Return's template path for errors page |
879
|
|
|
* |
880
|
|
|
* @return string |
881
|
|
|
*/ |
882
|
|
|
public function getErrorsPageTemplatePath() |
883
|
|
|
{ |
884
|
|
|
return $this->errorsPageTemplatePath; |
885
|
|
|
} |
886
|
|
|
|
887
|
|
|
/** |
888
|
|
|
* Returns template path for possible configured welcome page |
889
|
|
|
* |
890
|
|
|
* @return string |
891
|
|
|
*/ |
892
|
|
|
public function getWelcomePageTemplatePath() |
893
|
|
|
{ |
894
|
|
|
return $this->welcomePageTemplatePath; |
895
|
|
|
} |
896
|
|
|
|
897
|
|
|
/** |
898
|
|
|
* Returns template path for possible configured auto index page |
899
|
|
|
* |
900
|
|
|
* @return string |
901
|
|
|
*/ |
902
|
|
|
public function getAutoIndexTemplatePath() |
903
|
|
|
{ |
904
|
|
|
return $this->autoIndexTemplatePath; |
905
|
|
|
} |
906
|
|
|
|
907
|
|
|
/** |
908
|
|
|
* Return's worker number |
909
|
|
|
* |
910
|
|
|
* @return int |
911
|
|
|
*/ |
912
|
|
|
public function getWorkerNumber() |
913
|
|
|
{ |
914
|
|
|
return (int)$this->workerNumber; |
915
|
|
|
} |
916
|
|
|
|
917
|
|
|
/** |
918
|
|
|
* Return's worker's accept min count |
919
|
|
|
* |
920
|
|
|
* @return int |
921
|
|
|
*/ |
922
|
|
|
public function getWorkerAcceptMin() |
923
|
|
|
{ |
924
|
|
|
return (int)$this->workerAcceptMin; |
925
|
|
|
} |
926
|
|
|
|
927
|
|
|
/** |
928
|
|
|
* Return's worker's accept max count |
929
|
|
|
* |
930
|
|
|
* @return int |
931
|
|
|
*/ |
932
|
|
|
public function getWorkerAcceptMax() |
933
|
|
|
{ |
934
|
|
|
return (int)$this->workerAcceptMax; |
935
|
|
|
} |
936
|
|
|
|
937
|
|
|
/** |
938
|
|
|
* Return's the auto index configuration |
939
|
|
|
* |
940
|
|
|
* @return boolean |
941
|
|
|
*/ |
942
|
|
|
public function getAutoIndex() |
943
|
|
|
{ |
944
|
|
|
return (boolean)$this->autoIndex; |
945
|
|
|
} |
946
|
|
|
|
947
|
|
|
/** |
948
|
|
|
* Return's server context type |
949
|
|
|
* |
950
|
|
|
* @return string |
951
|
|
|
*/ |
952
|
|
|
public function getServerContextType() |
953
|
|
|
{ |
954
|
|
|
return $this->serverContextType; |
955
|
|
|
} |
956
|
|
|
|
957
|
|
|
/** |
958
|
|
|
* Returns stream context type |
959
|
|
|
* |
960
|
|
|
* @return string |
961
|
|
|
*/ |
962
|
|
|
public function getStreamContextType() |
963
|
|
|
{ |
964
|
|
|
return $this->streamContextType; |
965
|
|
|
} |
966
|
|
|
|
967
|
|
|
/** |
968
|
|
|
* Return's server context type |
969
|
|
|
* |
970
|
|
|
* @return string |
971
|
|
|
*/ |
972
|
|
|
public function getRequestContextType() |
973
|
|
|
{ |
974
|
|
|
return $this->requestContextType; |
975
|
|
|
} |
976
|
|
|
|
977
|
|
|
/** |
978
|
|
|
* Return's socket type |
979
|
|
|
* |
980
|
|
|
* @return string |
981
|
|
|
*/ |
982
|
|
|
public function getSocketType() |
983
|
|
|
{ |
984
|
|
|
return $this->socketType; |
985
|
|
|
} |
986
|
|
|
|
987
|
|
|
/** |
988
|
|
|
* Return's worker type |
989
|
|
|
* |
990
|
|
|
* @return string |
991
|
|
|
*/ |
992
|
|
|
public function getWorkerType() |
993
|
|
|
{ |
994
|
|
|
return $this->workerType; |
995
|
|
|
} |
996
|
|
|
|
997
|
|
|
/** |
998
|
|
|
* Return's document root |
999
|
|
|
* |
1000
|
|
|
* @return string |
1001
|
|
|
*/ |
1002
|
|
|
public function getDocumentRoot() |
1003
|
|
|
{ |
1004
|
|
|
return $this->documentRoot; |
1005
|
|
|
} |
1006
|
|
|
|
1007
|
|
|
/** |
1008
|
|
|
* Return's directory index definition |
1009
|
|
|
* |
1010
|
|
|
* @return string |
1011
|
|
|
*/ |
1012
|
|
|
public function getDirectoryIndex() |
1013
|
|
|
{ |
1014
|
|
|
return $this->directoryIndex; |
1015
|
|
|
} |
1016
|
|
|
|
1017
|
|
|
/** |
1018
|
|
|
* Return's the connection handlers |
1019
|
|
|
* |
1020
|
|
|
* @return array |
1021
|
|
|
*/ |
1022
|
|
|
public function getConnectionHandlers() |
1023
|
|
|
{ |
1024
|
|
|
return $this->connectionHandlers; |
1025
|
|
|
} |
1026
|
|
|
|
1027
|
|
|
/** |
1028
|
|
|
* Returns the headers used by the server |
1029
|
|
|
* |
1030
|
|
|
* @return array |
1031
|
|
|
*/ |
1032
|
|
|
public function getHeaders() |
1033
|
|
|
{ |
1034
|
|
|
return $this->headers; |
1035
|
|
|
} |
1036
|
|
|
|
1037
|
|
|
/** |
1038
|
|
|
* Returns the certificates used by the server |
1039
|
|
|
* |
1040
|
|
|
* @return array |
1041
|
|
|
*/ |
1042
|
|
|
public function getCertificates() |
1043
|
|
|
{ |
1044
|
|
|
return $this->certificates; |
1045
|
|
|
} |
1046
|
|
|
|
1047
|
|
|
/** |
1048
|
|
|
* Return's the virtual hosts |
1049
|
|
|
* |
1050
|
|
|
* @return array |
1051
|
|
|
*/ |
1052
|
|
|
public function getVirtualHosts() |
1053
|
|
|
{ |
1054
|
|
|
return $this->virtualHosts; |
1055
|
|
|
} |
1056
|
|
|
|
1057
|
|
|
/** |
1058
|
|
|
* Return's the authentication information's |
1059
|
|
|
* |
1060
|
|
|
* @return array |
1061
|
|
|
*/ |
1062
|
|
|
public function getAuthentications() |
1063
|
|
|
{ |
1064
|
|
|
return $this->authentications; |
1065
|
|
|
} |
1066
|
|
|
|
1067
|
|
|
/** |
1068
|
|
|
* Return's modules |
1069
|
|
|
* |
1070
|
|
|
* @return array |
1071
|
|
|
*/ |
1072
|
|
|
public function getModules() |
1073
|
|
|
{ |
1074
|
|
|
return $this->modules; |
1075
|
|
|
} |
1076
|
|
|
|
1077
|
|
|
/** |
1078
|
|
|
* Return's array |
1079
|
|
|
* |
1080
|
|
|
* @return array |
1081
|
|
|
*/ |
1082
|
|
|
public function getHandlers() |
1083
|
|
|
{ |
1084
|
|
|
return $this->handlers; |
|
|
|
|
1085
|
|
|
} |
1086
|
|
|
|
1087
|
|
|
/** |
1088
|
|
|
* Return's cert path |
1089
|
|
|
* |
1090
|
|
|
* @return string |
1091
|
|
|
*/ |
1092
|
|
|
public function getCertPath() |
1093
|
|
|
{ |
1094
|
|
|
return $this->certPath; |
1095
|
|
|
} |
1096
|
|
|
|
1097
|
|
|
/** |
1098
|
|
|
* Return's passphrase |
1099
|
|
|
* |
1100
|
|
|
* @return string |
1101
|
|
|
*/ |
1102
|
|
|
public function getPassphrase() |
1103
|
|
|
{ |
1104
|
|
|
return $this->passphrase; |
1105
|
|
|
} |
1106
|
|
|
|
1107
|
|
|
/** |
1108
|
|
|
* Returns the environment variable configuration |
1109
|
|
|
* |
1110
|
|
|
* @return array |
1111
|
|
|
*/ |
1112
|
|
|
public function getEnvironmentVariables() |
1113
|
|
|
{ |
1114
|
|
|
return $this->environmentVariables; |
1115
|
|
|
} |
1116
|
|
|
|
1117
|
|
|
/** |
1118
|
|
|
* Returns the access configuration. |
1119
|
|
|
* |
1120
|
|
|
* @return array |
1121
|
|
|
*/ |
1122
|
|
|
public function getAccesses() |
1123
|
|
|
{ |
1124
|
|
|
return $this->accesses; |
1125
|
|
|
} |
1126
|
|
|
|
1127
|
|
|
/** |
1128
|
|
|
* Returns the locations. |
1129
|
|
|
* |
1130
|
|
|
* @return array |
1131
|
|
|
*/ |
1132
|
|
|
public function getLocations() |
1133
|
|
|
{ |
1134
|
|
|
return $this->locations; |
1135
|
|
|
} |
1136
|
|
|
|
1137
|
|
|
/** |
1138
|
|
|
* Returns the rewrite maps. |
1139
|
|
|
* |
1140
|
|
|
* @return array |
1141
|
|
|
*/ |
1142
|
|
|
public function getRewriteMaps() |
1143
|
|
|
{ |
1144
|
|
|
return $this->rewriteMaps; |
1145
|
|
|
} |
1146
|
|
|
|
1147
|
|
|
/** |
1148
|
|
|
* Return's DH param path |
1149
|
|
|
* |
1150
|
|
|
* @return string |
1151
|
|
|
*/ |
1152
|
|
|
public function getDhParamPath() |
1153
|
|
|
{ |
1154
|
|
|
return $this->dhParamPath; |
1155
|
|
|
} |
1156
|
|
|
|
1157
|
|
|
/** |
1158
|
|
|
* Return's private key path |
1159
|
|
|
* |
1160
|
|
|
* @return string |
1161
|
|
|
*/ |
1162
|
|
|
public function getPrivateKeyPath() |
1163
|
|
|
{ |
1164
|
|
|
return $this->privateKeyPath; |
1165
|
|
|
} |
1166
|
|
|
|
1167
|
|
|
/** |
1168
|
|
|
* Return's the crypto method to use |
1169
|
|
|
* |
1170
|
|
|
* @return string |
1171
|
|
|
*/ |
1172
|
|
|
public function getCryptoMethod() |
1173
|
|
|
{ |
1174
|
|
|
return $this->cryptoMethod; |
1175
|
|
|
} |
1176
|
|
|
|
1177
|
|
|
/** |
1178
|
|
|
* Return's the peer name to be used, if this value is not set, then the name is guessed based on the hostname used when opening the stream |
1179
|
|
|
* |
1180
|
|
|
* @return string |
1181
|
|
|
*/ |
1182
|
|
|
public function getPeerName() |
1183
|
|
|
{ |
1184
|
|
|
return $this->peerName; |
1185
|
|
|
} |
1186
|
|
|
|
1187
|
|
|
/** |
1188
|
|
|
* Return's TRUE it the verification of use SSL certificate has to be required |
1189
|
|
|
* |
1190
|
|
|
* @return boolean |
1191
|
|
|
*/ |
1192
|
|
|
public function getVerifyPeer() |
1193
|
|
|
{ |
1194
|
|
|
return $this->verifyPeer; |
1195
|
|
|
} |
1196
|
|
|
|
1197
|
|
|
/** |
1198
|
|
|
* Return's TRUE it the peer name has to be verified |
1199
|
|
|
* |
1200
|
|
|
* @return boolean |
1201
|
|
|
*/ |
1202
|
|
|
public function getVerifyPeerName() |
1203
|
|
|
{ |
1204
|
|
|
return $this->verifyPeerName; |
1205
|
|
|
} |
1206
|
|
|
|
1207
|
|
|
/** |
1208
|
|
|
* Return's TRUE to disable TLS compression. This can help mitigate the CRIME attack vector |
1209
|
|
|
* |
1210
|
|
|
* @return boolean |
1211
|
|
|
*/ |
1212
|
|
|
public function getDisableCompression() |
1213
|
|
|
{ |
1214
|
|
|
return $this->disableCompression; |
1215
|
|
|
} |
1216
|
|
|
|
1217
|
|
|
/** |
1218
|
|
|
* Return's TRUE if self-signed certificates has to be allowed, but requires verify_peer to be FALSE |
1219
|
|
|
* |
1220
|
|
|
* @return boolean |
1221
|
|
|
*/ |
1222
|
|
|
public function getAllowSelfSigned() |
1223
|
|
|
{ |
1224
|
|
|
return $this->allowSelfSigned; |
1225
|
|
|
} |
1226
|
|
|
|
1227
|
|
|
/** |
1228
|
|
|
* Return's TRUE if control cipher ordering preferences during negotiation has to be allowed |
1229
|
|
|
* |
1230
|
|
|
* @return boolean |
1231
|
|
|
*/ |
1232
|
|
|
public function getHonorCipherOrder() |
1233
|
|
|
{ |
1234
|
|
|
return $this->honorCipherOrder; |
1235
|
|
|
} |
1236
|
|
|
|
1237
|
|
|
/** |
1238
|
|
|
* Return's the curve to use with ECDH ciphers, if not specified prime256v1 will be used |
1239
|
|
|
* |
1240
|
|
|
* @return string |
1241
|
|
|
*/ |
1242
|
|
|
public function getEcdhCurve() |
1243
|
|
|
{ |
1244
|
|
|
return $this->ecdhCurve; |
1245
|
|
|
} |
1246
|
|
|
|
1247
|
|
|
/** |
1248
|
|
|
* Return's TRUE if a new key pair has to be created in scenarios where ECDH cipher suites are negotiated (instead of the preferred ECDHE ciphers) |
1249
|
|
|
* |
1250
|
|
|
* @return boolean |
1251
|
|
|
*/ |
1252
|
|
|
public function getSingleEcdhUse() |
1253
|
|
|
{ |
1254
|
|
|
return $this->singleEcdhUse; |
1255
|
|
|
} |
1256
|
|
|
|
1257
|
|
|
/** |
1258
|
|
|
* Return's TRUE if new key pair has to be created when using DH parameters (improves forward secrecy) |
1259
|
|
|
* |
1260
|
|
|
* @return boolean |
1261
|
|
|
*/ |
1262
|
|
|
public function getSingleDhUse() |
1263
|
|
|
{ |
1264
|
|
|
return $this->singleDhUse; |
1265
|
|
|
} |
1266
|
|
|
|
1267
|
|
|
/** |
1268
|
|
|
* Return's the list of available ciphers. |
1269
|
|
|
* |
1270
|
|
|
* @return string |
1271
|
|
|
* @link http://php.net/manual/en/context.ssl.php#context.ssl.ciphers |
1272
|
|
|
* @link https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER_LIST_FORMAT |
1273
|
|
|
*/ |
1274
|
|
|
public function getCiphers() |
1275
|
|
|
{ |
1276
|
|
|
return $this->ciphers; |
1277
|
|
|
} |
1278
|
|
|
} |
1279
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: