diff --git a/src/assay.cc b/src/assay.cc index 098f27f2..1f5a09b0 100644 --- a/src/assay.cc +++ b/src/assay.cc @@ -219,6 +219,9 @@ int Assay::processURI(const char *uri, const char *protocol, const char *pos = strchr(m_uri_decoded.c_str(), '?'); + store_variable("REQUEST_LINE", std::string(protocol) + " " + + std::string(uri) + " HTTP/" + std::string(http_version)); + std::string path_info; if (pos == NULL) { path_info = std::string(m_uri_decoded, 0); diff --git a/test/test-cases/regression/variable-REQUEST_LINE.json b/test/test-cases/regression/variable-REQUEST_LINE.json new file mode 100644 index 00000000..678f7c58 --- /dev/null +++ b/test/test-cases/regression/variable-REQUEST_LINE.json @@ -0,0 +1,45 @@ +[ + { + "enabled":1, + "version_min":300000, + "title":"Testing Variables :: REQUEST_LINE", + "client":{ + "ip":"200.249.12.31", + "port":123 + }, + "server":{ + "ip":"200.249.12.31", + "port":80 + }, + "request":{ + "headers":{ + "Host":"localhost", + "User-Agent":"curl/7.38.0", + "Accept":"*/*" + }, + "uri":"/?key=value&key=other_value", + "protocol":"GET", + "http_version":1.1 + }, + "response":{ + "headers":{ + "Date":"Mon, 13 Jul 2015 20:02:41 GMT", + "Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT", + "Content-Type":"text/html" + }, + "body":[ + "no need." + ] + }, + "expected":{ + "debug_log":"Target value: \"GET /\\?key=value\\&key=other_value HTTP/1.1\" \\(Variable: REQUEST_LINE\\)" + }, + "rules":[ + "SecRuleEngine On", + "SecDebugLog \/tmp\/modsec_debug.log", + "SecDebugLogLevel 9", + "SecRule REQUEST_LINE \"@contains test \" \"pass,t:trim\"" + ] + } +] +