src/transaction.cc
/**
 * @name    processResponseBody
 * @brief   Perform the request body (if any)
 *
 * This method perform the analysis on the request body. It is optional to
 * call that method. If this API consumer already know that there isn't a
 * body for inspect it is recommended to skip this step.
 *
 * @note It is necessary to "append" the request body prior to the execution
 *       of this method.
 * @note Remember to check for a possible intervention.
 *
 * @returns If the operation was successful or not.
 * @retval true Operation was successful.
 * @retval false Operation failed.
 *
 */
@name    processResponseBody
@brief   Perform the request body (if any)

This method perform the analysis on the request body. It is optional to
call that method. If this API consumer already know that there isn't a
body for inspect it is recommended to skip this step.

@note It is necessary to "append" the request body prior to the execution
of this method.
@note Remember to check for a possible intervention.

@returns If the operation was successful or not.
@retval true Operation was successful.
@retval false Operation failed.
@name processResponseBody @brief Perform the request body ( if any ) This method perform the analysis on the request body . It is optional to call that method . If this API consumer already know that there isn ' t a body for inspect it is recommended to skip this step . @note It is necessary to " append " the request body prior to the execution of this method . @note Remember to check for a possible intervention . @returns If the operation was successful or not . @retval true Operation was successful . @retval false Operation failed .
int Transaction::processResponseBody() {
#ifndef NO_LOGS
    debug(4, "Starting phase RESPONSE_BODY. (SecRules 4)");
#endif
    if (m_rules->m_secRuleEngine == Rules::DisabledRuleEngine) {
#ifndef NO_LOGS
        debug(4, "Rule engine disabled, returning...");
#endif
        return true;
    }
    std::set<std::string> &bi = this->m_rules->m_responseBodyTypeToBeInspected;
    auto t = bi.find(*m_responseContentType);
    if (t == bi.end() && bi.empty() == false) {
#ifndef NO_LOGS
        debug(5, "Response Content-Type is " + *m_responseContentType + \
            ". It is not marked to be inspected.");
        std::string validContetTypes("");
        for (std::set<std::string>::iterator i = bi.begin();
             i != bi.end(); i++) {
            validContetTypes.append(*i + " ");
        }
        debug(8, "Content-Type(s) marked to be inspected: " + validContetTypes);
#endif
        return true;
    }
    if (m_collections.resolveFirst("OUTBOUND_DATA_ERROR") == NULL) {
        m_collections.store("OUTBOUND_DATA_ERROR", "0");
    }
    m_collections.store("RESPONSE_BODY", m_responseBody.str());
    m_collections.store("RESPONSE_CONTENT_LENGTH",
        std::to_string(m_responseBody.str().size()));
    this->m_rules->evaluate(modsecurity::ResponseBodyPhase, this);
    return true;
}
int Transaction :: processResponseBody ( ) { #ifndef NO_LOGS debug ( 4 , " " ) ; #endif if ( m_rules -> m_secRuleEngine == Rules :: DisabledRuleEngine ) { #ifndef NO_LOGS debug ( 4 , " " ) ; #endif return true ; } std :: set < std :: string > & bi = this -> m_rules -> m_responseBodyTypeToBeInspected ; auto t = bi . find ( * m_responseContentType ) ; if ( t == bi . end ( ) && bi . empty ( ) == false ) { #ifndef NO_LOGS debug ( 5 , " " + * m_responseContentType + " " ) ; std :: string validContetTypes ( " " ) ; for ( std :: set < std :: string > :: iterator i = bi . begin ( ) ; i != bi . end ( ) ; i ++ ) { validContetTypes . append ( * i + " " ) ; } debug ( 8 , " " + validContetTypes ) ; #endif return true ; } if ( m_collections . resolveFirst ( " " ) == NULL ) { m_collections . store ( " " , " " ) ; } m_collections . store ( " " , m_responseBody . str ( ) ) ; m_collections . store ( " " , std :: to_string ( m_responseBody . str ( ) . size ( ) ) ) ; this -> m_rules -> evaluate ( modsecurity :: ResponseBodyPhase , this ) ; return true ; }
@name    processResponseBody
 @brief   Perform the request body (if any)
@name processResponseBody @brief Perform the request body ( if any )