diff --git a/src/facade/dragonfly_connection.cc b/src/facade/dragonfly_connection.cc index e43c78f8c..39725001d 100644 --- a/src/facade/dragonfly_connection.cc +++ b/src/facade/dragonfly_connection.cc @@ -928,7 +928,7 @@ io::Result Connection::CheckForHttpProto() { return MatchHttp11Line(ib); } last_len = io_buf_.InputLen(); - UpdateIoBufCapacity(io_buf_, stats_, [&]() { io_buf_.EnsureCapacity(io_buf_.Capacity()); }); + UpdateIoBufCapacity(io_buf_, stats_, [&]() { io_buf_.EnsureCapacity(128); }); } while (last_len < 1024); return false; @@ -959,10 +959,7 @@ void Connection::ConnectionFlow() { // Main loop. if (parse_status != ERROR && !ec) { - if (io_buf_.AppendLen() < 64) { - UpdateIoBufCapacity(io_buf_, stats_, - [&]() { io_buf_.EnsureCapacity(io_buf_.Capacity() * 2); }); - } + UpdateIoBufCapacity(io_buf_, stats_, [&]() { io_buf_.EnsureCapacity(64); }); auto res = IoLoop(); if (holds_alternative(res)) { diff --git a/tests/dragonfly/connection_test.py b/tests/dragonfly/connection_test.py index a59c4a39c..cdd10c958 100755 --- a/tests/dragonfly/connection_test.py +++ b/tests/dragonfly/connection_test.py @@ -606,6 +606,14 @@ async def test_subscribe_in_pipeline(async_client: aioredis.Redis): assert res == ["one", ["subscribe", "ch1", 1], "two", ["subscribe", "ch2", 2], "three"] +async def test_match_http(df_server: DflyInstance): + client = df_server.client() + reader, writer = await asyncio.open_connection("localhost", df_server.port) + for i in range(2000): + writer.write(f"foo bar ".encode()) + await writer.drain() + + """ This test makes sure that Dragonfly can receive blocks of pipelined commands even while a script is still executing. This is a dangerous scenario because both the dispatch fiber