Non-latin character broken on HttpHeader by HttpObjectDecoder.
Motivation: Currently netty is receiving HTTP request by ByteBuf and store it as "CharSequence" on HttpObjectDecoder. During this operation, all character on ByteBuf is moving to char[] without breaking encoding. But in process() function, type casting from byte to char does not consider msb (sign-bit). So the value over 127 can be casted wrong value. (ex : 0xec in byte -> 0xffec in char). This is type casting bug. Modification: Fix type casting Result: Non-latin characters work.
This commit is contained in:
parent
13cd69c5ec
commit
71b338ce17
@ -805,7 +805,7 @@ public abstract class HttpObjectDecoder extends ByteToMessageDecoder {
|
||||
|
||||
@Override
|
||||
public boolean process(byte value) throws Exception {
|
||||
char nextByte = (char) value;
|
||||
char nextByte = (char) (value & 0xFF);
|
||||
if (nextByte == HttpConstants.CR) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user