File: read.cc

package info (click to toggle)
modsecurity 3.0.3-1%2Bdeb10u2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 42,032 kB
  • sloc: cpp: 25,953; ansic: 15,785; sh: 5,357; python: 3,556; yacc: 2,896; makefile: 1,394; lex: 1,344; perl: 464; ruby: 69; javascript: 53; php: 42
file content (34 lines) | stat: -rw-r--r-- 784 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#include <stdio.h>
#include <string.h>

#include <modsecurity/modsecurity.h>


// Variable offset - REQUEST_HEADERS_NAMES

const char *request = "" \
    "GET /index.html?param1=value1&param2=value1&param3=value1 HTTP/\n" \
    "AuThOrIzAtIoN: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\n" \
    "Host: localhost\n" \
    "Content-Length: 27\n" \
    "Content-Type: application/x-www-form-urlencoded\n";


int main() {
    modsecurity::ModSecurity msc;
    std::string json("");
    const char *err = NULL;
    int ret = 0;

    ret = msc.processContentOffset(request, strlen(request),
        "o0,4v64,13v114,4v130,14v149,12t:lowercase", &json, &err);

    if (ret >= 0) {
        std::cout << json << std::endl;
    } else {
        std::cout << err << std::endl;
    }

    return ret;
}