OpenVPN 3 Core Library
Loading...
Searching...
No Matches
test_headredact.cpp
Go to the documentation of this file.
1#include "test_common.hpp"
2
3// #define OPENVPN_HTTP_HEADERS_NO_REDACT
4
6
7using namespace openvpn;
8
9static const std::string in1 = "HEADERS: POST /pg HTTP/1.1\r\n"
10 " Host: 3.91.106.178\r\n"
11 " User-Agent: japicli\r\n"
12 " Authorization: Basic cGc6cHJqN1hKQUpuRkRsZ2V5MXZLaVlVcGhL\r\n"
13 " Content-Type: application/json\r\n"
14 " Content-Length: 49\r\n"
15 " Accept-Encoding: lz4\r\n"
16 " Accept: */*\r\n"
17 " \r\n";
18
19static const std::string out1 = "HEADERS: POST /pg HTTP/1.1\r\n"
20 " Host: 3.91.106.178\r\n"
21 " User-Agent: japicli\r\n"
22 " Authorization: Basic [REDACTED]\r\n"
23 " Content-Type: application/json\r\n"
24 " Content-Length: 49\r\n"
25 " Accept-Encoding: lz4\r\n"
26 " Accept: */*\r\n"
27 " \r\n";
28
29static const std::string in2 = "HEADERS: POST /pg HTTP/1.1\r\n"
30 " Host: 3.91.106.178\r\n"
31 " User-Agent: japicli\r\n"
32 " authorization=basic cGc6cHJqN1hKQUpuRkRsZ2V5MXZLaVlVcGhL\r\n"
33 " Content-Type: application/json\r\n"
34 " Content-Length: 49\r\n"
35 " Accept-Encoding: lz4\r\n"
36 " Accept: */*\r\n"
37 " \r\n";
38
39static const std::string out2 = "HEADERS: POST /pg HTTP/1.1\r\n"
40 " Host: 3.91.106.178\r\n"
41 " User-Agent: japicli\r\n"
42 " authorization=basic [REDACTED]\r\n"
43 " Content-Type: application/json\r\n"
44 " Content-Length: 49\r\n"
45 " Accept-Encoding: lz4\r\n"
46 " Accept: */*\r\n"
47 " \r\n";
48
49TEST(http, headredact1)
50{
51 const std::string out = HTTP::headers_redact(in1);
52 ASSERT_EQ(out, out1);
53}
54
55TEST(http, headredact2)
56{
57 const std::string out = HTTP::headers_redact(in2);
58 ASSERT_EQ(out, out2);
59}
std::string headers_redact(const std::string &headers)
TEST(http, headredact1)
static const std::string out1
static const std::string in1
static const std::string in2
static const std::string out2
static std::stringstream out
Definition test_path.cpp:10