summaryrefslogtreecommitdiffstats
path: root/WebCore/websockets/WebSocketChannel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/websockets/WebSocketChannel.cpp')
-rw-r--r--WebCore/websockets/WebSocketChannel.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/WebCore/websockets/WebSocketChannel.cpp b/WebCore/websockets/WebSocketChannel.cpp
index a222b4d..5c0f4c3 100644
--- a/WebCore/websockets/WebSocketChannel.cpp
+++ b/WebCore/websockets/WebSocketChannel.cpp
@@ -118,7 +118,7 @@ void WebSocketChannel::didOpen(SocketStreamHandle* handle)
ASSERT(handle == m_handle);
const CString& handshakeMessage = m_handshake.clientHandshakeMessage();
if (!handle->send(handshakeMessage.data(), handshakeMessage.length())) {
- LOG(Network, "Error in sending handshake message.");
+ m_context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, "Error sending handshake message.", 0, m_handshake.clientOrigin());
handle->close();
}
}
@@ -150,7 +150,7 @@ void WebSocketChannel::didReceiveData(SocketStreamHandle* handle, const char* da
handle->close();
return;
}
- if (m_handshake.mode() != WebSocketHandshake::Connected) {
+ if (m_handshake.mode() == WebSocketHandshake::Incomplete) {
int headerLength = m_handshake.readServerHandshake(m_buffer, m_bufferSize);
if (headerLength <= 0)
return;
@@ -179,6 +179,8 @@ void WebSocketChannel::didReceiveData(SocketStreamHandle* handle, const char* da
return;
LOG(Network, "remaining in read buf %ul", m_bufferSize);
}
+ if (m_handshake.mode() != WebSocketHandshake::Connected)
+ return;
const char* nextFrame = m_buffer;
const char* p = m_buffer;
@@ -246,7 +248,7 @@ bool WebSocketChannel::appendToBuffer(const char* data, int len)
m_bufferSize += len;
return true;
}
- LOG(Network, "Too long WebSocket frame %d", m_bufferSize + len);
+ m_context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, String::format("WebSocket frame (at %d bytes) is too long.", m_bufferSize + len), 0, m_handshake.clientOrigin());
return false;
}