mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Adds protocol and http version to processUri method's signature
Protocol and http version will be further used to fill some variables and the audit log.
This commit is contained in:
@@ -87,7 +87,7 @@ int main(int argc, char *argv[]) {
|
||||
std::cout << "There is an intervention" << std::endl;
|
||||
continue;
|
||||
}
|
||||
modsecAssay->processURI(request_uri);
|
||||
modsecAssay->processURI(request_uri, "GET", "1.1");
|
||||
if (modsecAssay->intervention()) {
|
||||
std::cout << "There is an intervention" << std::endl;
|
||||
continue;
|
||||
|
@@ -85,12 +85,13 @@ void perform_unit_test(std::vector<RegressionTest *> *tests,
|
||||
if (r.status != 200) {
|
||||
goto end;
|
||||
}
|
||||
if (t->uri.empty() == false) {
|
||||
modsec_assay->processURI(t->uri.c_str());
|
||||
actions(&r, modsec_assay->intervention());
|
||||
if (r.status != 200) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
modsec_assay->processURI(t->uri.c_str(), t->protocol.c_str(),
|
||||
t->httpVersion.c_str());
|
||||
|
||||
actions(&r, modsec_assay->intervention());
|
||||
if (r.status != 200) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (std::pair<std::string, std::string> headers :
|
||||
|
@@ -141,6 +141,12 @@ RegressionTest *RegressionTest::from_yajl_node(const yajl_val &node) {
|
||||
if (strcmp(key2, "uri") == 0) {
|
||||
u->uri = YAJL_GET_STRING(val2);
|
||||
}
|
||||
if (strcmp(key2, "protocol") == 0) {
|
||||
u->protocol = YAJL_GET_STRING(val2);
|
||||
}
|
||||
if (strcmp(key2, "http_version") == 0) {
|
||||
u->httpVersion = YAJL_GET_NUMBER(val2);
|
||||
}
|
||||
if (strcmp(key2, "headers") == 0) {
|
||||
u->request_headers = yajl_array_to_map(val2);
|
||||
}
|
||||
|
@@ -56,6 +56,8 @@ class RegressionTest {
|
||||
int clientPort;
|
||||
int serverPort;
|
||||
|
||||
std::string protocol;
|
||||
std::string httpVersion;
|
||||
std::string uri;
|
||||
|
||||
static inline std::string yajl_array_to_str(const yajl_val &node);
|
||||
|
@@ -26,7 +26,9 @@
|
||||
"Pragma": "no-cache",
|
||||
"Cache-Control": "no-cache"
|
||||
},
|
||||
"uri": "GET \/test.pl?param1= test ¶m2=test2",
|
||||
"uri": "\/test.pl?param1= test ¶m2=test2",
|
||||
"protocol": "GET",
|
||||
"http_version": 1.1,
|
||||
"body": ""
|
||||
},
|
||||
"response": {
|
||||
@@ -85,7 +87,9 @@
|
||||
"Pragma": "no-cache",
|
||||
"Cache-Control": "no-cache"
|
||||
},
|
||||
"uri": "GET \/test.pl?param1= test ¶m2=test2",
|
||||
"uri": "\/test.pl?param1= test ¶m2=test2",
|
||||
"protocol": "GET",
|
||||
"http_version": 1.1,
|
||||
"body": ""
|
||||
},
|
||||
"response": {
|
||||
@@ -145,7 +149,9 @@
|
||||
"Pragma": "no-cache",
|
||||
"Cache-Control": "no-cache"
|
||||
},
|
||||
"uri": "GET \/test.pl?param1= test ¶m2=test2",
|
||||
"uri": "\/test.pl?param1= test ¶m2=test2",
|
||||
"protocol": "GET",
|
||||
"http_version": 1.1,
|
||||
"body": ""
|
||||
},
|
||||
"response": {
|
||||
@@ -205,7 +211,9 @@
|
||||
"Pragma": "no-cache",
|
||||
"Cache-Control": "no-cache"
|
||||
},
|
||||
"uri": "GET \/test.pl?param1= test ¶m2=test2",
|
||||
"uri": "\/test.pl?param1= test ¶m2=test2",
|
||||
"protocol": "GET",
|
||||
"http_version": 1.1,
|
||||
"body": ""
|
||||
},
|
||||
"response": {
|
||||
@@ -264,7 +272,9 @@
|
||||
"Pragma": "no-cache",
|
||||
"Cache-Control": "no-cache"
|
||||
},
|
||||
"uri": "GET \/test.pl?param1= test ¶m2=test2",
|
||||
"uri": "\/test.pl?param1= test ¶m2=test2",
|
||||
"protocol": "GET",
|
||||
"http_version": 1.1,
|
||||
"body": ""
|
||||
},
|
||||
"response": {
|
||||
@@ -323,7 +333,9 @@
|
||||
"Pragma": "no-cache",
|
||||
"Cache-Control": "no-cache"
|
||||
},
|
||||
"uri": "GET \/test.pl?param1= test ¶m2=test2",
|
||||
"uri": "\/test.pl?param1= test ¶m2=test2",
|
||||
"protocol": "GET",
|
||||
"http_version": 1.1,
|
||||
"body": ""
|
||||
},
|
||||
"response": {
|
||||
|
@@ -25,7 +25,9 @@
|
||||
"Pragma": "no-cache",
|
||||
"Cache-Control": "no-cache"
|
||||
},
|
||||
"uri": "GET \/test.pl?param1= test ¶m2=test2",
|
||||
"uri": "\/test.pl?param1= test ¶m2=test2",
|
||||
"protocol": "GET",
|
||||
"http_version": 1.1,
|
||||
"body": ""
|
||||
},
|
||||
"response": {
|
||||
|
@@ -26,7 +26,9 @@
|
||||
"Pragma": "no-cache",
|
||||
"Cache-Control": "no-cache"
|
||||
},
|
||||
"uri": "GET \/test.pl?param1=test¶2=test2",
|
||||
"uri": "\/test.pl?param1=test¶2=test2",
|
||||
"protocol": "GET",
|
||||
"http_version": 1.1,
|
||||
"body": ""
|
||||
},
|
||||
"response": {
|
||||
|
@@ -16,7 +16,9 @@
|
||||
},
|
||||
"request": {
|
||||
"headers": "",
|
||||
"body": ""
|
||||
"body": "",
|
||||
"protocol": "GET",
|
||||
"http_version": 1.1
|
||||
},
|
||||
"response": {
|
||||
"headers": "",
|
||||
|
@@ -26,7 +26,9 @@
|
||||
"Pragma": "no-cache",
|
||||
"Cache-Control": "no-cache"
|
||||
},
|
||||
"uri": "GET \/test.pl?param1= test ¶m2=test2",
|
||||
"uri": "\/test.pl?param1= test ¶m2=test2",
|
||||
"protocol": "GET",
|
||||
"http_version": 1.1,
|
||||
"body": ""
|
||||
},
|
||||
"response": {
|
||||
@@ -84,7 +86,9 @@
|
||||
"Pragma": "no-cache",
|
||||
"Cache-Control": "no-cache"
|
||||
},
|
||||
"uri": "GET \/test.pl?param1= WHEE ¶m2=test2",
|
||||
"uri": "\/test.pl?param1= WHEE ¶m2=test2",
|
||||
"protocol": "GET",
|
||||
"http_version": 1.1,
|
||||
"body": ""
|
||||
},
|
||||
"response": {
|
||||
|
Reference in New Issue
Block a user