Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mgmt/rpc/server/IPCSocketServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ IPCSocketServer::Client::read_all(Buffer &bw) const
return {false, swoc::bwprint(buff, "Peer disconnected. EOF")};
}
bw.save(ret);
if (_max_req_size - bw.stored() > 0) { // we can still read more.
if (bw.stored() < _max_req_size) { // we can still read more.
using namespace std::chrono_literals;
if (!this->poll_for_data(1ms)) {
return {true, buff};
Expand Down
9 changes: 9 additions & 0 deletions src/mgmt/rpc/server/unit_tests/test_rpcserver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,15 @@ TEST_CASE("Sending a message bigger than the internal server's buffer. 32000", "
auto resp = rpc_client.query(json);
REQUIRE(resp == R"({"jsonrpc": "2.0", "result": {"size": "32000"}, "id": "32k_1"})");
}());

const int oversized_message_size{64000};
auto oversized_json{R"({"jsonrpc": "2.0", "method": "do_nothing32000", "params": {"msg":")" +
random_string(oversized_message_size) + R"("}, "id":"over-limit"})"};
REQUIRE_NOTHROW([&]() {
ScopedLocalSocket rpc_client;
auto resp = rpc_client.query(oversized_json);
REQUIRE(resp.empty());
}());
}
REQUIRE(rpc::test_remove_handler("do_nothing32000"));
}
Expand Down