Bug 362740 - Websocket D13 close handling is off [autobahn]
+ Address autobahn 0.4.3 test case 7.5.1 Description: Send a close frame with invalid UTF8 payload Expectation: Clean close with protocol error or invalid utf8 code
This commit is contained in:
parent
e207ea357e
commit
da60996ce5
|
@ -748,8 +748,15 @@ public class WebSocketConnectionD13 extends AbstractConnection implements WebSoc
|
|||
{
|
||||
code=(0xff&buffer.array()[buffer.getIndex()])*0x100+(0xff&buffer.array()[buffer.getIndex()+1]);
|
||||
if (buffer.length()>2)
|
||||
message=new String(buffer.array(),buffer.getIndex()+2,buffer.length()-2,StringUtil.__UTF8);
|
||||
} else if(buffer.length() == 1)
|
||||
{
|
||||
if(_utf8.append(buffer.array(),buffer.getIndex()+2,buffer.length()-2,_connection.getMaxTextMessageSize()))
|
||||
{
|
||||
message = _utf8.toString();
|
||||
_utf8.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(buffer.length() == 1)
|
||||
{
|
||||
// Invalid length. use status code 1002 (Protocol error)
|
||||
errorClose(WebSocketConnectionD13.CLOSE_PROTOCOL,"Invalid payload length of 1");
|
||||
|
|
Loading…
Reference in New Issue