diff --git a/src/assay.cc b/src/assay.cc index 38a49d94..fd7e0563 100644 --- a/src/assay.cc +++ b/src/assay.cc @@ -512,7 +512,7 @@ int Assay::processRequestBody() { if (m_requestBodyType == MultiPartRequestBody) { std::string *a = resolve_variable_first("REQUEST_HEADERS:Content-Type"); if (a != NULL) { - Multipart m(*a); + Multipart m(*a, this); if (m.init() == true) { m.process(m_requestBody.str()); diff --git a/src/request_body_processor/multipart.cc b/src/request_body_processor/multipart.cc index 0deaabf7..a6e131ff 100644 --- a/src/request_body_processor/multipart.cc +++ b/src/request_body_processor/multipart.cc @@ -24,7 +24,7 @@ namespace ModSecurity { namespace RequestBodyProcessor { -Multipart::Multipart(std:: string header) +Multipart::Multipart(std:: string header, Assay *assay) : crlf(false), containsDataAfter(false), containsDataBefore(false), @@ -33,6 +33,7 @@ Multipart::Multipart(std:: string header) invalidQuote(false), boundaryStartsWithWhiteSpace(false), boundaryIsQuoted(false), + m_assay(assay), m_header(header) { } diff --git a/src/request_body_processor/multipart.h b/src/request_body_processor/multipart.h index 0150ff05..e43899bb 100644 --- a/src/request_body_processor/multipart.h +++ b/src/request_body_processor/multipart.h @@ -27,7 +27,7 @@ namespace RequestBodyProcessor { class Multipart { public: - explicit Multipart(std::string header); + Multipart(std::string header, Assay *assay); bool init(); bool boundaryContainsOnlyValidCharacters(); @@ -46,12 +46,13 @@ class Multipart { bool missingSemicolon; bool invalidQuote; - private: void debug(int a, std::string str) { - std::cout << "Debug: " << str << std::endl; + m_assay->debug(a, str); } + private: std::string m_boundary; std::string m_header; + Assay *m_assay; }; } // namespace RequestBodyProcessor diff --git a/src/request_body_processor/multipart_blob.h b/src/request_body_processor/multipart_blob.h index 9cf3ab56..8d69ff27 100644 --- a/src/request_body_processor/multipart_blob.h +++ b/src/request_body_processor/multipart_blob.h @@ -32,15 +32,14 @@ class MultipartBlob { bool processContentDispositionLine(const std::string &dispositionLine); bool processContentTypeLine(const std::string &contentTypeLine); - void debug(int a, std::string str) { - std::cout << "Debug: " << str << std::endl; - } - bool invalidQuote; std::string name; std::string filename; std::string contentType; std::string content; + void debug(int a, std::string str) { + m_parent->debug(a, str); + } private: const std::string m_blob; Multipart *m_parent;