if (!m_isFragmented && frame.isContinuationFrame())
{
clear();
- Q_EMIT errorEncountered(QWebSocketProtocol::CC_PROTOCOL_ERROR, QWebSocket::tr("Received Continuation frame /*with FIN=true*/, while there is nothing to continue."));
+ Q_EMIT errorEncountered(QWebSocketProtocol::CC_PROTOCOL_ERROR, tr("Received Continuation frame /*with FIN=true*/, while there is nothing to continue."));
return;
}
if (m_isFragmented && frame.isDataFrame() && !frame.isContinuationFrame())
{
clear();
- Q_EMIT errorEncountered(QWebSocketProtocol::CC_PROTOCOL_ERROR, QWebSocket::tr("All data frames after the initial data frame must have opcode 0 (continuation)."));
+ Q_EMIT errorEncountered(QWebSocketProtocol::CC_PROTOCOL_ERROR, tr("All data frames after the initial data frame must have opcode 0 (continuation)."));
return;
}
if (!frame.isContinuationFrame())
if ((messageLength + quint64(frame.getPayload().length())) > MAX_MESSAGE_SIZE_IN_BYTES)
{
clear();
- Q_EMIT errorEncountered(QWebSocketProtocol::CC_TOO_MUCH_DATA, QWebSocket::tr("Received message is too big."));
+ Q_EMIT errorEncountered(QWebSocketProtocol::CC_TOO_MUCH_DATA, tr("Received message is too big."));
return;
}
if (failed)
{
clear();
- Q_EMIT errorEncountered(QWebSocketProtocol::CC_WRONG_DATATYPE, QWebSocket::tr("Invalid UTF-8 code encountered."));
+ Q_EMIT errorEncountered(QWebSocketProtocol::CC_WRONG_DATATYPE, tr("Invalid UTF-8 code encountered."));
return;
}
else
{
if (state() == QAbstractSocket::ConnectedState)
{
- close(QWebSocketProtocol::CC_GOING_AWAY, QWebSocket::tr("Connection closed"));
+ close(QWebSocketProtocol::CC_GOING_AWAY, tr("Connection closed"));
}
releaseConnections(m_pSocket);
m_pSocket->deleteLater();
}
else
{
- setErrorString(QWebSocket::tr("Error writing bytes to socket: %1.").arg(m_pSocket->errorString()));
+ setErrorString(tr("Error writing bytes to socket: %1.").arg(m_pSocket->errorString()));
qDebug() << errorString();
m_pSocket->flush();
Q_EMIT q->error(QAbstractSocket::NetworkError);
}
if (payloadWritten != data.size())
{
- setErrorString(QWebSocket::tr("Bytes written %1 != %2.").arg(payloadWritten).arg(data.size()));
+ setErrorString(tr("Bytes written %1 != %2.").arg(payloadWritten).arg(data.size()));
qDebug() << errorString();
Q_EMIT q->error(QAbstractSocket::NetworkError);
}
}
if (!ok)
{
- errorDescription = QWebSocket::tr("Invalid statusline in response: %1.").arg(statusLine);
+ errorDescription = tr("Invalid statusline in response: %1.").arg(statusLine);
}
else
{
ok = (accept == acceptKey);
if (!ok)
{
- errorDescription = QWebSocket::tr("Accept-Key received from server %1 does not match the client key %2.").arg(acceptKey).arg(accept);
+ errorDescription = tr("Accept-Key received from server %1 does not match the client key %2.").arg(acceptKey).arg(accept);
}
}
else
{
- errorDescription = QWebSocket::tr("Invalid statusline in response: %1.").arg(statusLine);
+ errorDescription = tr("Invalid statusline in response: %1.").arg(statusLine);
}
}
else if (httpStatusCode == 400) //HTTP/1.1 400 Bad Request
{
//if needed to switch protocol version, then we are finished here
//because we cannot handle other protocols than the RFC one (v13)
- errorDescription = QWebSocket::tr("Handshake: Server requests a version that we don't support: %1.").arg(versions.join(", "));
+ errorDescription = tr("Handshake: Server requests a version that we don't support: %1.").arg(versions.join(", "));
ok = false;
}
else
{
//we tried v13, but something different went wrong
- errorDescription = QWebSocket::tr("Unknown error condition encountered. Aborting connection.");
+ errorDescription = tr("Unknown error condition encountered. Aborting connection.");
ok = false;
}
}
}
else
{
- errorDescription = QWebSocket::tr("Unhandled http status code: %1.").arg(httpStatusCode);
+ errorDescription = tr("Unhandled http status code: %1.").arg(httpStatusCode);
ok = false;
}
if (!QWebSocketProtocol::isCloseCodeValid(closeCode))
{
closeCode = QWebSocketProtocol::CC_PROTOCOL_ERROR;
- closeReason = QWebSocket::tr("Invalid close code %1 detected.").arg(closeCode);
+ closeReason = tr("Invalid close code %1 detected.").arg(closeCode);
}
else
{
if (failed)
{
closeCode = QWebSocketProtocol::CC_WRONG_DATATYPE;
- closeReason = QWebSocket::tr("Invalid UTF-8 code encountered.");
+ closeReason = tr("Invalid UTF-8 code encountered.");
}
}
}
while (!m_pendingConnections.isEmpty())
{
QWebSocket *pWebSocket = m_pendingConnections.dequeue();
- pWebSocket->close(QWebSocketProtocol::CC_GOING_AWAY, QWebSocketServer::tr("Server closed."));
+ pWebSocket->close(QWebSocketProtocol::CC_GOING_AWAY, tr("Server closed."));
pWebSocket->deleteLater();
}
m_pTcpServer->deleteLater();
else
{
//TODO: should set or emit error
- qDebug() << QWebSocketServer::tr("Upgrading to websocket failed.");
+ qDebug() << tr("Upgrading to websocket failed.");
}
}
else
{
//TODO: should set or emit error
- qDebug() << QWebSocketServer::tr("Cannot upgrade to websocket.");
+ qDebug() << tr("Cannot upgrade to websocket.");
}
}
else
{
//TODO: should set or emit error
- qDebug() << QWebSocketServer::tr("Invalid response received.");
+ qDebug() << tr("Invalid response received.");
}
if (!success)
{
//TODO: should set or emit error
- qDebug() << QWebSocketServer::tr("Closing socket because of invalid or unsupported request.");
+ qDebug() << tr("Closing socket because of invalid or unsupported request.");
pTcpSocket->close();
}
}