Skip to content

Commit

Permalink
fix core: immediately ret when limit for log=0
Browse files Browse the repository at this point in the history
Relates: <HIDDEN_URL>
commit_hash:d54afc6b398fc892b139797b303180ce9dcec545
  • Loading branch information
ArkadyRudenko committed Jan 26, 2025
1 parent 5da918f commit e7c1a9f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions core/src/server/handlers/http_handler_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,12 @@ std::string HttpHandlerBase::GetRequestBodyForLoggingChecked(
const std::string& request_body
) const {
try {
return GetRequestBodyForLogging(request, context, request_body);
const auto limit = GetConfig().request_body_size_log_limit;
if (limit == 0) {
return utils::log::ToLimitedUtf8(request_body, 0);
}
auto logging_request_body = GetRequestBodyForLogging(request, context, request_body);
return utils::log::ToLimitedUtf8(logging_request_body, limit);
} catch (const std::exception& ex) {
LOG_LIMITED_ERROR() << "failed to get request body for logging: " << ex;
return "<error in GetRequestBodyForLogging>";
Expand All @@ -380,7 +385,12 @@ std::string HttpHandlerBase::GetResponseDataForLoggingChecked(
const std::string& response_data
) const {
try {
return GetResponseDataForLogging(request, context, response_data);
const auto limit = GetConfig().response_data_size_log_limit;
if (limit == 0) {
return utils::log::ToLimitedUtf8(response_data, 0);
}
auto logging_response_data = GetResponseDataForLogging(request, context, response_data);
return utils::log::ToLimitedUtf8(logging_response_data, limit);
} catch (const std::exception& ex) {
LOG_LIMITED_ERROR() << "failed to get response data for logging: " << ex;
return "<error in GetResponseDataForLogging>";
Expand Down

0 comments on commit e7c1a9f

Please sign in to comment.