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:
Felipe Zimmerle
2016-06-20 23:57:02 -03:00
parent a36b2da86a
commit b8bd0c5960
6 changed files with 37 additions and 23 deletions

View File

@@ -147,7 +147,7 @@ int main(int argc, char *argv[]) {
modsecTransaction->addResponseHeader("Content-Length",
"200");
modsecTransaction->processResponseHeaders();
modsecTransaction->processResponseHeaders(200, "HTTP 1.2");
if (modsecTransaction->intervention(&it)) {
std::cout << "There is an intervention" << std::endl;
@@ -165,7 +165,7 @@ int main(int argc, char *argv[]) {
}
next_request:
modsecTransaction->processLogging(200);
modsecTransaction->processLogging();
delete modsecTransaction;
}

View File

@@ -246,17 +246,21 @@ void perform_unit_test(ModSecurityTest<RegressionTest> *test,
t->clientPort, t->serverIp.c_str(), t->serverPort);
actions(&r, modsec_transaction);
#if 0
if (r.status != 200) {
goto end;
}
#endif
modsec_transaction->processURI(t->uri.c_str(), t->method.c_str(),
t->httpVersion.c_str());
actions(&r, modsec_transaction);
#if 0
if (r.status != 200) {
goto end;
}
#endif
for (std::pair<std::string, std::string> headers :
t->request_headers) {
@@ -267,7 +271,7 @@ void perform_unit_test(ModSecurityTest<RegressionTest> *test,
modsec_transaction->processRequestHeaders();
actions(&r, modsec_transaction);
if (r.status != 200) {
goto end;
//goto end;
}
modsec_transaction->appendRequestBody(
@@ -275,9 +279,11 @@ void perform_unit_test(ModSecurityTest<RegressionTest> *test,
t->request_body.size());
modsec_transaction->processRequestBody();
actions(&r, modsec_transaction);
#if 0
if (r.status != 200) {
goto end;
}
#endif
for (std::pair<std::string, std::string> headers :
t->response_headers) {
@@ -285,23 +291,27 @@ void perform_unit_test(ModSecurityTest<RegressionTest> *test,
headers.second.c_str());
}
modsec_transaction->processResponseHeaders();
modsec_transaction->processResponseHeaders(r.status, "HTTP 1.1");
actions(&r, modsec_transaction);
#if 0
if (r.status != 200) {
goto end;
}
#endif
modsec_transaction->appendResponseBody(
(unsigned char *)t->response_body.c_str(),
t->response_body.size());
modsec_transaction->processResponseBody();
actions(&r, modsec_transaction);
#if 0
if (r.status != 200) {
goto end;
}
#endif
end:
modsec_transaction->processLogging(r.status);
modsec_transaction->processLogging();
CustomDebugLog *d = reinterpret_cast<CustomDebugLog *>
(modsec_rules->m_debugLog);