Loosen up handshake size checks to accept javascript clients.
Reviewers: buda Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D366
This commit is contained in:
parent
87e5dc0dfb
commit
9640633dd1
@ -85,10 +85,6 @@ class Session : public Loggable {
|
||||
} else if (buffer_.size() < HANDSHAKE_SIZE) {
|
||||
logger.debug("Received partial handshake of size {}", buffer_.size());
|
||||
return;
|
||||
} else if (buffer_.size() > HANDSHAKE_SIZE) {
|
||||
logger.debug("Received too large handshake of size {}", buffer_.size());
|
||||
ClientFailureInvalidData();
|
||||
return;
|
||||
} else {
|
||||
logger.debug("Decoding handshake of size {}", buffer_.size());
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ State StateHandshakeRun(Session &session) {
|
||||
}
|
||||
session.connected_ = true;
|
||||
|
||||
// Delete data from buffer. It is guaranteed that there will be exactly
|
||||
// 20 bytes in the buffer so we can use buffer_.size() here.
|
||||
session.buffer_.Shift(session.buffer_.size());
|
||||
// Delete data from buffer. It is guaranteed that there will more than, or
|
||||
// equal to 20 bytes (HANDSHAKE_SIZE) in the buffer.
|
||||
session.buffer_.Shift(HANDSHAKE_SIZE);
|
||||
|
||||
return State::Init;
|
||||
}
|
||||
|
@ -162,20 +162,6 @@ TEST(BoltSession, HandshakeInTwoPackets) {
|
||||
CheckOutput(output, handshake_resp, 4);
|
||||
}
|
||||
|
||||
TEST(BoltSession, HandshakeTooLarge) {
|
||||
INIT_VARS;
|
||||
|
||||
auto buff = session.Allocate();
|
||||
memcpy(buff.data, handshake_req, 20);
|
||||
memcpy(buff.data + 20, handshake_req, 20);
|
||||
session.Written(40);
|
||||
session.Execute();
|
||||
|
||||
ASSERT_EQ(session.state_, StateT::Close);
|
||||
ASSERT_FALSE(session.socket_.IsOpen());
|
||||
PrintOutput(output);
|
||||
CheckFailureMessage(output);
|
||||
}
|
||||
|
||||
TEST(BoltSession, HandshakeWriteFail) {
|
||||
INIT_VARS;
|
||||
|
Loading…
Reference in New Issue
Block a user