[HttpObjectDecoder] Include hex-value of illegal whitespace char (#11067)
Motivation: HttpObjectDecoder may throw an IllegalArgumentException if it encounters a character that Character.isWhitespace() returns true for, but is not one of the two valid OWS (optional whitespace) values. Such values may not have friendly or readable toString() values. We should include the hex value so that the illegal character can always be determined. Modifications: Add hex value as well Result: Easier to debug Co-authored-by: Bennett Lynch <Bennett-Lynch@users.noreply.github.com>
This commit is contained in:
parent
4f498709d4
commit
bf9b90c340
@ -905,7 +905,7 @@ public abstract class HttpObjectDecoder extends ByteToMessageDecoder {
|
|||||||
} else if (validateOWS && !isOWS(c)) {
|
} else if (validateOWS && !isOWS(c)) {
|
||||||
// Only OWS is supported for whitespace
|
// Only OWS is supported for whitespace
|
||||||
throw new IllegalArgumentException("Invalid separator, only a single space or horizontal tab allowed," +
|
throw new IllegalArgumentException("Invalid separator, only a single space or horizontal tab allowed," +
|
||||||
" but received a '" + c + "'");
|
" but received a '" + c + "' (0x" + Integer.toHexString(c) + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sb.length();
|
return sb.length();
|
||||||
|
Loading…
Reference in New Issue
Block a user