Mark,
On 4/1/21 16:00, Mark Thomas wrote:
On 01/04/2021 17:08, Christopher Schultz wrote:
<snip/>
The javadoc says that it must be called before reading any request
parameters OR calling getReader() but there is only a check for the
reader.
Maybe we should change the check to:
if (usingReader || parametersParsed) {
return;
}
+1
And also, change Request.parseParameters to add:
// getCharacterEncoding() may have been overridden to
search for
// hidden form field containing request encoding
Charset charset = getCharset();
// Add this line, here:
coyoteRequest.setCharset(charset);
I'm less sure of this because of this line in the Javadoc for
getCharacterEncoding():
@return ... <code>null</code> if the request does not specify a
character encoding
It is at this point that the character set is truly committed, at
least when parsing parameters.
In getReader, we have similar logic, where we set the character set
for the request after determining what it actually is:
Which suggests the second of the above changes might be OK even if the
spec suggests otherwise.
At the moment, I'm leaning towards just the first of your proposed
changes but I'm open to arguments to do more.
I'm happy with incremental changes. Making the first change will be an
improvement for sure.
On the other hand, if code calls request.setCharacterEncoding(non-null)
then it will overwrite whatever the request had previously sent
(including null). So in that case, request.getCharacterEncoding isn't
always returning "what the client sent".
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org