mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
API CHANGE: response status is now set on processResponseHeaders
That change was needed to move the variable attribution to earliest as possible. We also have a new field for HTTP_PROTOCOL version used on the response.
This commit is contained in:
@@ -823,16 +823,22 @@ int Transaction::appendRequestBody(const unsigned char *buf, size_t len) {
|
||||
*
|
||||
* @note Remember to check for a possible intervention.
|
||||
*
|
||||
* @param code The returned http code.
|
||||
* @param proto Protocol used on the response.
|
||||
*
|
||||
* @returns If the operation was successful or not.
|
||||
* @retval true Operation was successful.
|
||||
* @retval false Operation failed.
|
||||
*
|
||||
*/
|
||||
int Transaction::processResponseHeaders() {
|
||||
int Transaction::processResponseHeaders(int code, const std::string& proto) {
|
||||
#ifndef NO_LOGS
|
||||
debug(4, "Starting phase RESPONSE_HEADERS. (SecRules 3)");
|
||||
#endif
|
||||
|
||||
this->m_httpCodeReturned = code;
|
||||
this->m_collections.store("STATUS", std::to_string(code));
|
||||
|
||||
if (m_rules->secRuleEngine == Rules::DisabledRuleEngine) {
|
||||
#ifndef NO_LOGS
|
||||
debug(4, "Rule engine disabled, returning...");
|
||||
@@ -1123,7 +1129,7 @@ int Transaction::getResponseBodyLenth() {
|
||||
* @retval false Operation failed.
|
||||
*
|
||||
*/
|
||||
int Transaction::processLogging(int returned_code) {
|
||||
int Transaction::processLogging() {
|
||||
#ifndef NO_LOGS
|
||||
debug(4, "Starting phase LOGGING. (SecRules 5)");
|
||||
#endif
|
||||
@@ -1135,9 +1141,6 @@ int Transaction::processLogging(int returned_code) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this->m_httpCodeReturned = returned_code;
|
||||
this->m_collections.store("STATUS", std::to_string(returned_code));
|
||||
|
||||
this->m_rules->evaluate(ModSecurity::LoggingPhase, this);
|
||||
|
||||
/* If relevant, save this transaction information at the audit_logs */
|
||||
@@ -1720,8 +1723,9 @@ extern "C" int msc_request_body_from_file(Transaction *transaction,
|
||||
* @retval 0 Operation failed.
|
||||
*
|
||||
*/
|
||||
extern "C" int msc_process_response_headers(Transaction *transaction) {
|
||||
return transaction->processResponseHeaders();
|
||||
extern "C" int msc_process_response_headers(Transaction *transaction,
|
||||
int code, const char* protocol) {
|
||||
return transaction->processResponseHeaders(code, protocol);
|
||||
}
|
||||
|
||||
|
||||
@@ -1961,15 +1965,14 @@ extern "C" int msc_get_response_body_length(Transaction *transaction) {
|
||||
* delivered prior to the execution of this function.
|
||||
*
|
||||
* @param transaction ModSecurity transaction.
|
||||
* @param code HTTP code returned to the user.
|
||||
*
|
||||
* @returns If the operation was successful or not.
|
||||
* @retval 1 Operation was successful.
|
||||
* @retval 0 Operation failed.
|
||||
*
|
||||
*/
|
||||
extern "C" int msc_process_logging(Transaction *transaction, int code) {
|
||||
return transaction->processLogging(code);
|
||||
extern "C" int msc_process_logging(Transaction *transaction) {
|
||||
return transaction->processLogging();
|
||||
}
|
||||
|
||||
} // namespace modsecurity
|
||||
|
Reference in New Issue
Block a user