From 2f0bfcdee9dd86cf7d1cf7147f0be6d33d96484a Mon Sep 17 00:00:00 2001 From: gggeek Date: Sat, 25 Feb 2023 13:29:27 +0000 Subject: [PATCH] comments --- src/Client.php | 5 +++-- src/Helper/Charset.php | 1 - src/Helper/Http.php | 6 +++--- src/Helper/XMLParser.php | 12 +++++++++--- src/Value.php | 2 -- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Client.php b/src/Client.php index 9ed54fc5..5d973950 100644 --- a/src/Client.php +++ b/src/Client.php @@ -669,7 +669,7 @@ class Client * * @todo check correctness of urlencoding cookie value (copied from php way of doing it, but php is generally sending * response not requests. We do the opposite...) - * @todo strip invalid chars from cookie name? As per RFC6265, we should follow RFC2616, Section 2.2 + * @todo strip invalid chars from cookie name? As per RFC 6265, we should follow RFC 2616, Section 2.2 * @todo drop/rename $port parameter. Cookies are not isolated by port! * @todo feature-creep allow storing 'expires', 'secure', 'httponly' and 'samesite' cookie attributes (we could do * as php, and allow $path to be an array of attributes...) @@ -822,6 +822,7 @@ class Client return $this->multicall($req, $timeout, $method); } elseif (is_string($req)) { $n = new static::$requestClass(''); + /// @todo we should somehow allow the caller to declare a custom contenttype too, esp. for the charset declaration $n->setPayload($req); $req = $n; } @@ -986,7 +987,7 @@ class Client $uri = $path; } - // Cookie generation, as per RFC6265 + // Cookie generation, as per RFC 6265 // NB: the following code does not honour 'expires', 'path' and 'domain' cookie attributes set to client obj by the user... $cookieHeader = ''; if (count($opts['cookies'])) { diff --git a/src/Helper/Charset.php b/src/Helper/Charset.php index d4cadd38..9133825f 100644 --- a/src/Helper/Charset.php +++ b/src/Helper/Charset.php @@ -55,7 +55,6 @@ class Charset /** * @param string $tableName * @return void - * * @throws ValueErrorException for unsupported $tableName * * @todo add support for cp1252 as well as latin-2 .. latin-10 diff --git a/src/Helper/Http.php b/src/Helper/Http.php index 971ca42c..1c505829 100644 --- a/src/Helper/Http.php +++ b/src/Helper/Http.php @@ -11,7 +11,7 @@ class Http use LoggerAware; /** - * Decode a string that is encoded with "chunked" transfer encoding as defined in rfc2068 par. 19.4.6. + * Decode a string that is encoded with "chunked" transfer encoding as defined in RFC 2068 par. 19.4.6. * Code shamelessly stolen from nusoap library by Dietrich Ayala. * @internal this function will become protected in the future * @@ -72,8 +72,8 @@ class Http * @return array with keys 'headers', 'cookies', 'raw_data' and 'status_code' * @throws HttpException * - * @todo if $debug is < 0, we could avoid populating 'raw_data' and 'headers' in the returned value - but that would - * be a weird API... + * @todo if $debug is < 0, we could avoid populating 'raw_data' in the returned value - but that would + * be a weird API... (note that we still need to always have headers parsed for content charset) */ public function parseResponseHeaders(&$data, $headersProcessed = false, $debug = 0) { diff --git a/src/Helper/XMLParser.php b/src/Helper/XMLParser.php index c23b6fc5..7676c20c 100644 --- a/src/Helper/XMLParser.php +++ b/src/Helper/XMLParser.php @@ -839,6 +839,7 @@ class XMLParser /** * xml charset encoding guessing helper function. * Tries to determine the charset encoding of an XML chunk received over HTTP. + * * NB: according to the spec (RFC 3023), if text/xml content-type is received over HTTP without a content-type, * we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of non-conforming (legacy?) clients/servers, * which will be most probably using UTF-8 anyway... @@ -855,6 +856,8 @@ class XMLParser * @return string the encoding determined. Null if it can't be determined and mbstring is enabled, * PhpXmlRpc::$xmlrpc_defencoding if it can't be determined and mbstring is not enabled * + * @todo as of 2023, the relevant RFC for XML Media Types is now 7303, and for HTTP it is 9110. Check if the order of + * precedence implemented here is still correct * @todo explore usage of mb_http_input(): does it detect http headers + post data? if so, use it instead of hand-detection!!! * @todo feature-creep make it possible to pass in options overriding usage of PhpXmlRpc static variables, to make * the method independent of global state @@ -927,10 +930,13 @@ class XMLParser return $enc; } else { - // no encoding specified: as per HTTP1.1 assume it is iso-8859-1? - // Both RFC 2616 (HTTP 1.1) and 1945 (HTTP 1.0) clearly state that for text/xxx content types + // No encoding specified: assume it is iso-8859-1, as per HTTP1.1? + // Both RFC 2616 (HTTP 1.1) and RFC 1945 (HTTP 1.0) clearly state that for text/xxx content types // this should be the standard. And we should be getting text/xml as request and response. - // BUT we have to be backward compatible with the lib, which always used UTF-8 as default... + // BUT we have to be backward compatible with the lib, which always used UTF-8 as default. Moreover, + // RFC 7231, which obsoletes the two RFC mentioned above, has changed the rules. It says: + // "The default charset of ISO-8859-1 for text media types has been removed; the default is now whatever + // the media type definition says." return PhpXmlRpc::$xmlrpc_defencoding; } } diff --git a/src/Value.php b/src/Value.php index 64a9dbeb..357f206b 100644 --- a/src/Value.php +++ b/src/Value.php @@ -443,7 +443,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * @param mixed $offset * @param mixed $value * @return void - * * @throws ValueErrorException|TypeErrorException */ #[\ReturnTypeWillChange] @@ -521,7 +520,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * * @param mixed $offset * @return void - * * @throws ValueErrorException|StateErrorException */ #[\ReturnTypeWillChange] -- 2.47.0