diff options
author | Remi Collet <remi@php.net> | 2014-11-18 08:01:18 +0100 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2014-11-18 08:01:18 +0100 |
commit | a740f9e7838ef11e36923874cfc796e6e719048f (patch) | |
tree | a033c3c4415b29eaaa90ef0d310439d2feb06eb3 /sapi/fpm/tests/include.inc | |
parent | d8868b654e9e6780468bc300d7e62df54ecf5a43 (diff) | |
download | php-git-a740f9e7838ef11e36923874cfc796e6e719048f.tar.gz |
Include small MIT FastCGI client library from
https://github.com/adoy/PHP-FastCGI-Client
Add run_request function to easily run a FastCGI call,
which is needed for new tests.
Diffstat (limited to 'sapi/fpm/tests/include.inc')
-rw-r--r-- | sapi/fpm/tests/include.inc | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/sapi/fpm/tests/include.inc b/sapi/fpm/tests/include.inc index 983cbd3454..5d01ae693d 100644 --- a/sapi/fpm/tests/include.inc +++ b/sapi/fpm/tests/include.inc @@ -76,4 +76,26 @@ function run_fpm_till($needle, $config, $max = 10) /* {{{ */ } /* }}} */ -?> +function run_request($host, $port, $uri='/ping', $query='') { + require_once 'fcgi.inc'; + $client = new Adoy\FastCGI\Client($host, $port); + $params = array( + 'GATEWAY_INTERFACE' => 'FastCGI/1.0', + 'REQUEST_METHOD' => 'GET', + 'SCRIPT_FILENAME' => $uri, + 'SCRIPT_NAME' => $uri, + 'QUERY_STRING' => $query, + 'REQUEST_URI' => $uri . ($query ? '?'.$query : ""), + 'DOCUMENT_URI' => $uri, + 'SERVER_SOFTWARE' => 'php/fcgiclient', + 'REMOTE_ADDR' => '127.0.0.1', + 'REMOTE_PORT' => '9985', + 'SERVER_ADDR' => '127.0.0.1', + 'SERVER_PORT' => '80', + 'SERVER_NAME' => php_uname('n'), + 'SERVER_PROTOCOL' => 'HTTP/1.1', + 'CONTENT_TYPE' => '', + 'CONTENT_LENGTH' => 0 + ); + return $client->request($params, false)."\n"; +} |