mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Adds offset regression tests and assorted fixes on var's offsets
This commit is contained in:
committed by
Felipe Zimmerle
parent
795994bb0e
commit
4ad3574cf2
@@ -31,6 +31,7 @@ class CustomDebugLog : public modsecurity::debug_log::DebugLog {
|
||||
void write(int level, const std::string& message) override;
|
||||
bool contains(const std::string& pattern);
|
||||
std::string log_messages();
|
||||
std::string error_log_messages();
|
||||
|
||||
private:
|
||||
std::stringstream m_log;
|
||||
|
@@ -475,7 +475,7 @@ int main(int argc, char **argv) {
|
||||
if (r->passed == true && r->skipped == false) {
|
||||
passed++;
|
||||
} else if (r->skipped == false) {
|
||||
if (test.m_automake_output && 1 == 0) {
|
||||
if (test.m_automake_output) {
|
||||
// m_automake_output
|
||||
} else {
|
||||
std::cout << KRED << "Test failed." << RESET << KWHT \
|
||||
|
@@ -66,15 +66,15 @@ inline std::vector<std::string> RegressionTest::yajl_array_to_vec_str(
|
||||
}
|
||||
|
||||
|
||||
inline std::unordered_map<std::string, std::string>
|
||||
inline std::vector<std::pair<std::string, std::string>>
|
||||
RegressionTest::yajl_array_to_map(const yajl_val &node) {
|
||||
std::unordered_map<std::string, std::string> vec;
|
||||
std::vector<std::pair<std::string, std::string>> vec;
|
||||
for (int z = 0; z < node->u.object.len; z++) {
|
||||
const char *key = node->u.object.keys[z];
|
||||
yajl_val val3 = node->u.object.values[z];
|
||||
const char *value = YAJL_GET_STRING(val3);
|
||||
std::pair<std::string, std::string> a(key, value);
|
||||
vec.insert(a);
|
||||
vec.push_back(a);
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
@@ -18,8 +18,10 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#ifndef TEST_REGRESSION_REGRESSION_TEST_H_
|
||||
#define TEST_REGRESSION_REGRESSION_TEST_H_
|
||||
@@ -44,8 +46,8 @@ class RegressionTest {
|
||||
int version_max;
|
||||
int github_issue;
|
||||
|
||||
std::unordered_map<std::string, std::string> request_headers;
|
||||
std::unordered_map<std::string, std::string> response_headers;
|
||||
std::vector<std::pair<std::string, std::string>> request_headers;
|
||||
std::vector<std::pair<std::string, std::string>> response_headers;
|
||||
std::string request_body;
|
||||
std::string response_body;
|
||||
std::string response_protocol;
|
||||
@@ -68,8 +70,8 @@ class RegressionTest {
|
||||
static inline std::string yajl_array_to_str(const yajl_val &node);
|
||||
static inline std::vector<std::string> yajl_array_to_vec_str(
|
||||
const yajl_val &node);
|
||||
static inline std::unordered_map<std::string,
|
||||
std::string> yajl_array_to_map(const yajl_val &node);
|
||||
static inline std::vector<std::pair<std::string, std::string>>
|
||||
yajl_array_to_map(const yajl_val &node);
|
||||
|
||||
int http_code;
|
||||
std::string redirect_url;
|
||||
|
Reference in New Issue
Block a user