Skip to content

Commit

Permalink
http1 - engine was using too short buffer to detect longer HTTP requests
Browse files Browse the repository at this point in the history
  • Loading branch information
astibal committed Nov 11, 2024
1 parent a4305fb commit f8f6581
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/inspect/engine/http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace sx::engine::http {

auto ix_ref = data.find("Referer: ");
if (ix_ref != std::string::npos) {
std::string ref_start ( data.substr(ix_ref, std::min(std::size_t(128), data.size() - ix_ref)) );
std::string ref_start ( data.substr(ix_ref, std::min(std::size_t(1024), data.size() - ix_ref)) );
if (std::regex_search(ref_start, m_ref, ProtoRex::http_req_ref())) {
std::string str_temp;

Expand Down Expand Up @@ -64,7 +64,7 @@ namespace sx::engine::http {
return false;
};

std::string host_start( data.substr(ix_host, std::min(std::size_t(128), data.size() - ix_host)) );
std::string host_start( data.substr(ix_host, std::min(std::size_t(1024), data.size() - ix_host)) );

std::smatch m_host;
auto const regex_ret = std::regex_search(host_start, m_host, ProtoRex::http_req_host());
Expand Down Expand Up @@ -115,7 +115,7 @@ namespace sx::engine::http {
bool find_method (EngineCtx &ctx, std::string_view data) {
auto const& log = log::http1;

std::string method_start(data.substr(0, std::min(std::size_t(128), data.size())));
std::string method_start(data.substr(0, std::min(std::size_t(1024), data.size())));
std::smatch m_get;

if (std::regex_search(method_start, m_get, ProtoRex::http_req_get())) {
Expand Down

0 comments on commit f8f6581

Please sign in to comment.