diff --git a/src/facade/dragonfly_connection.cc b/src/facade/dragonfly_connection.cc index ef9242f1f..d60883839 100644 --- a/src/facade/dragonfly_connection.cc +++ b/src/facade/dragonfly_connection.cc @@ -801,7 +801,14 @@ io::Result Connection::CheckForHttpProto(FiberSocketBase* peer) { return make_unexpected(recv_sz.error()); } io_buf_.CommitWrite(*recv_sz); - string_view ib = ToSV(io_buf_.InputBuffer().subspan(last_len)); + string_view ib = ToSV(io_buf_.InputBuffer()); + if (ib.size() >= 2 && ib[0] == 22 && ib[1] == 3) { + // We matched the TLS handshake raw data, which means "peer" is a TCP socket. + // Reject the connection. + return make_unexpected(make_error_code(errc::protocol_not_supported)); + } + + ib = ib.substr(last_len); size_t pos = ib.find('\n'); if (pos != string_view::npos) { ib = ToSV(io_buf_.InputBuffer().first(last_len + pos)); diff --git a/src/server/dflycmd.cc b/src/server/dflycmd.cc index 5f43d13b5..bb1e21135 100644 --- a/src/server/dflycmd.cc +++ b/src/server/dflycmd.cc @@ -336,6 +336,9 @@ void DflyCmd::StartStable(CmdArgList args, ConnectionContext* cntx) { return rb->SendOk(); } +// DFLY TAKEOVER [timeout_sec] [SAVE] +// timeout_sec - number of seconds to wait for TAKEOVER to converge. A float. +// SAVE if create a snapshot before shutting down. void DflyCmd::TakeOver(CmdArgList args, ConnectionContext* cntx) { RedisReplyBuilder* rb = static_cast(cntx->reply_builder()); CmdArgParser parser{args};