*
* @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...)
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;
}
$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'])) {
/**
* @param string $tableName
* @return void
- *
* @throws ValueErrorException for unsupported $tableName
*
* @todo add support for cp1252 as well as latin-2 .. latin-10
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
*
* @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)
{
/**
* 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...
* @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
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;
}
}
* @param mixed $offset
* @param mixed $value
* @return void
- *
* @throws ValueErrorException|TypeErrorException
*/
#[\ReturnTypeWillChange]
*
* @param mixed $offset
* @return void
- *
* @throws ValueErrorException|StateErrorException
*/
#[\ReturnTypeWillChange]