Bug 666349: update status code usage to latest spec. r=mcmanus

This commit is contained in:
Jason Duell
2011-12-20 00:20:12 -08:00
parent 2f3f711a0b
commit 98829dc108
2 changed files with 16 additions and 13 deletions

View File

@@ -1048,13 +1048,10 @@ WebSocketChannel::ProcessInput(PRUint8 *buffer, PRUint32 count)
if (mListener) {
nsCString utf8Data((const char *)payload, payloadLength);
// Section 8.1 says to replace received non utf-8 sequences
// (which are non-conformant to send) with u+fffd,
// but secteam feels that silently rewriting messages is
// inappropriate - so we will fail the connection instead.
// Section 8.1 says to fail connection if invalid utf-8 in text message
if (!IsUTF8(utf8Data, false)) {
LOG(("WebSocketChannel:: text frame invalid utf-8\n"));
AbortSession(NS_ERROR_ILLEGAL_VALUE);
AbortSession(NS_ERROR_CANNOT_CONVERT_DATA);
return NS_ERROR_ILLEGAL_VALUE;
}
@@ -1276,6 +1273,8 @@ WebSocketChannel::ResultToCloseCode(nsresult resultCode)
resultCode == NS_ERROR_CONNECTION_REFUSED) {
return CLOSE_ABNORMAL;
}
if (resultCode == NS_ERROR_CANNOT_CONVERT_DATA)
return CLOSE_INVALID_PAYLOAD;
return CLOSE_PROTOCOL_ERROR;
}