Bug 1395527 part 2 - Delegate IsASCII and IsUTF8 to encoding_rs. r=froydnj

MozReview-Commit-ID: 49AGBPjW4Ca
This commit is contained in:
Henri Sivonen
2017-09-01 11:53:31 +03:00
parent 6d81c700c3
commit 3756bf2f04
3 changed files with 52 additions and 139 deletions

View File

@@ -1745,7 +1745,7 @@ WebSocketChannel::ProcessInput(uint8_t *buffer, uint32_t count)
}
// Section 8.1 says to fail connection if invalid utf-8 in text message
if (!IsUTF8(utf8Data, false)) {
if (!IsUTF8(utf8Data)) {
LOG(("WebSocketChannel:: text frame invalid utf-8\n"));
return NS_ERROR_CANNOT_CONVERT_DATA;
}
@@ -1796,7 +1796,7 @@ WebSocketChannel::ProcessInput(uint8_t *buffer, uint32_t count)
// (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.
if (!IsUTF8(mServerCloseReason, false)) {
if (!IsUTF8(mServerCloseReason)) {
LOG(("WebSocketChannel:: close frame invalid utf-8\n"));
return NS_ERROR_CANNOT_CONVERT_DATA;
}