* Please do not copy this file verbatim into your production server.
**/
-// give user a chance to see the source for this server instead of running the services
-if ($_SERVER['REQUEST_METHOD'] != 'POST' && isset($_GET['showSource'])) {
- highlight_file(__FILE__);
- die();
-}
-
-include_once __DIR__ . "/../../vendor/autoload.php";
+require_once __DIR__ . "/_bootstrap.php";
-// out-of-band information: let the client manipulate the server operations.
-// we do this to help the testsuite script: do not reproduce in production!
+// Out-of-band information: let the client manipulate the server operations.
+// We do this to help the testsuite script: do not reproduce in production!
if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) {
$GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = '/tmp/phpxmlrpc_coverage';
if (!is_dir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'])) {
$signatures = array_merge($signatures, $moreSignatures);
-// enable support for the NULL extension
+// Enable support for the NULL extension
PhpXmlRpc\PhpXmlRpc::$xmlrpc_null_extension = true;
$s = new PhpXmlRpc\Server($signatures, false);
$s->setdebug(3);
$s->compress_response = true;
-// out-of-band information: let the client manipulate the server operations.
-// we do this to help the testsuite script: do not reproduce in production!
+// Out-of-band information: let the client manipulate the server operations.
+// We do this to help the testsuite script: do not reproduce in production!
if (isset($_GET['RESPONSE_ENCODING'])) {
$s->response_charset_encoding = $_GET['RESPONSE_ENCODING'];
}
if (isset($_GET['EXCEPTION_HANDLING'])) {
$s->exception_handling = $_GET['EXCEPTION_HANDLING'];
}
+if (isset($_GET['FORCE_AUTH'])) {
+ // We implement both Basic and Digest auth in php to avoid having to set it up in a vhost.
+ // Code taken from php.net
+ // NB: we do NOT check for valid credentials!
+ if ($_GET['FORCE_AUTH'] == 'Basic') {
+ if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['REMOTE_USER']) && !isset($_SERVER['REDIRECT_REMOTE_USER'])) {
+ header('HTTP/1.0 401 Unauthorized');
+ header('WWW-Authenticate: Basic realm="Phpxmlrpc Basic Realm"');
+ die('Text visible if user hits Cancel button');
+ }
+ } elseif ($_GET['FORCE_AUTH'] == 'Digest') {
+ if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
+ header('HTTP/1.1 401 Unauthorized');
+ header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="'.uniqid().'",opaque="'.md5('Phpxmlrpc Digest Realm').'"');
+ die('Text visible if user hits Cancel button');
+ }
+ }
+}
+
$s->service();
-// that should do all we need!
+// That should do all we need!
-// out-of-band information: let the client manipulate the server operations.
-// we do this to help the testsuite script: do not reproduce in production!
+// Out-of-band information: let the client manipulate the server operations.
+// We do this to help the testsuite script: do not reproduce in production!
if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) {
include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php";
}