Skip to content

Commit

Permalink
MINIFICPP-2438 Do not parse json response for acknowledge on C2
Browse files Browse the repository at this point in the history
Signed-off-by: Ferenc Gerlits <[email protected]>
This closes #1851
  • Loading branch information
lordgamez authored and fgerlits committed Aug 2, 2024
1 parent 68e09fa commit e3fdae6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions docker/test/integration/features/minifi_c2_server.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Feature: MiNiFi can communicate with Apache NiFi MiNiFi C2 server
When all instances start up
Then the MiNiFi C2 server logs contain the following message: "acknowledged with a state of FULLY_APPLIED(DONE)" in less than 30 seconds
And a flowfile with the content "test" is placed in the monitored directory in less than 10 seconds
And the Minifi logs do not contain the following message: "Failed to parse json response: The document is empty. at 0" after 0 seconds

Scenario: MiNiFi flow config is updated from MiNiFi C2 server through SSL with SSL controller service
Given a file with the content "test" is present in "/tmp/input"
Expand Down
5 changes: 4 additions & 1 deletion libminifi/src/c2/protocols/RESTProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@
namespace org::apache::nifi::minifi::c2 {

C2Payload RESTProtocol::parseJsonResponse(const C2Payload &payload, std::span<const std::byte> response) const {
rapidjson::Document root;
if (payload.getOperation() == Operation::acknowledge) {
return {payload.getOperation(), state::UpdateState::READ_COMPLETE};
}

try {
rapidjson::Document root;
rapidjson::ParseResult ok = root.Parse(reinterpret_cast<const char*>(response.data()), response.size());
if (ok) {
std::string identifier;
Expand Down

0 comments on commit e3fdae6

Please sign in to comment.