From 74314da11f37232e8a011d66e2d4561550a38e9e Mon Sep 17 00:00:00 2001 From: gggeek Date: Mon, 1 Jun 2020 10:00:53 +0000 Subject: [PATCH] comments --- NEWS | 5 +++-- demo/server/discuss.php | 3 +++ demo/server/proxy.php | 2 ++ src/Server.php | 6 ++++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 4f1f558f..56c09380 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,8 @@ XML-RPC for PHP version 4.4.2 - 2020/3/4 -* fixed: `client->setCookie()` bug: values that contain spaces are now properly encoded in a way that get decoded back - to spaces on the receiving end if that one is running on php 7.4 (or does RFC-compliant cookie decoding) +* fixed: `client->setCookie()` bug: cookie values that contain spaces are now properly encoded in a way that gets them + decoded back to spaces on the receiving end if the server running on php 7.4 (or does RFC-compliant cookie decoding). + Beforehand we were encoding spaces to '+' characters. XML-RPC for PHP version 4.4.1 - 2019/7/29 diff --git a/demo/server/discuss.php b/demo/server/discuss.php index ac65209b..5ecbe638 100644 --- a/demo/server/discuss.php +++ b/demo/server/discuss.php @@ -85,6 +85,9 @@ function getComments($req) } } +// NB: take care not to output anything else after this call, as it will mess up the responses and it will be hard to +// debug. In case you have to do so, at least re-emit a correct Content-Length http header (requires output buffering) + $srv = new PhpXmlRpc\Server(array( "discuss.addComment" => array( "function" => "addComment", diff --git a/demo/server/proxy.php b/demo/server/proxy.php index 7f4d16c0..453c9a4f 100644 --- a/demo/server/proxy.php +++ b/demo/server/proxy.php @@ -74,6 +74,8 @@ function forward_request($req) } // run the server +// NB: take care not to output anything else after this call, as it will mess up the responses and it will be hard to +// debug. In case you have to do so, at least re-emit a correct Content-Length http header (requires output buffering) $server = new PhpXmlRpc\Server( array( 'xmlrpcproxy.call' => array( diff --git a/src/Server.php b/src/Server.php index 406f0569..bd21d68c 100644 --- a/src/Server.php +++ b/src/Server.php @@ -271,8 +271,10 @@ class Server } } - // do not output content-length header if php is compressing output for us: - // it will mess up measurements + // Do not output content-length header if php is compressing output for us: + // it will mess up measurements. + // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for + // responses up to 8000 bytes if ($phpNoSelfCompress) { header('Content-Length: ' . (int)strlen($payload)); } -- 2.47.0