MCPcopy Create free account
hub / github.com/apache/trafficserver / do_send_response

Function do_send_response

example/cripts/example1.cc:80–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80do_send_response()
81{
82 borrow resp = cripts::Client::Response::Get();
83 borrow conn = cripts::Client::Connection::Get();
84 string msg = "Eliminate TSCPP";
85
86 resp["Server"] = ""; // Deletes the Server header
87 resp["X-AMC"] = msg; // New header
88 resp["Cache-Control"] = "Private"; // Deletes old CC values, and sets a new one
89 resp["X-UUID"] = cripts::UUID::Unique::Get();
90 resp["X-tcpinfo"] = conn.tcpinfo.Log();
91 resp["X-Cache-Status"] = resp.cache;
92 resp["X-Integer"] = 666;
93 resp["X-Data"] = AsString(txn_data[2]);
94
95 resp["X-ASN"] = conn.geo.ASN();
96 resp["X-ASN-Name"] = conn.geo.ASNName();
97 resp["X-Country"] = conn.geo.Country();
98 resp["X-ISO-Country"] = conn.geo.CountryCode();
99
100 // Setup some connection parameters
101 conn.congestion = "bbr";
102 conn.dscp = 8;
103 conn.pacing = 100000;
104 conn.mark = 17;
105
106 // Some file operations (note that the paths aren't required here, can just be strings, but it's a good practice)
107 static const cripts::File::Path p1("/tmp/foo");
108 static const cripts::File::Path p2("/tmp/secret.txt");
109
110 if (cripts::File::Status(p1).type() == cripts::File::Type::regular) {
111 resp["X-Foo-Exists"] = "yes";
112 } else {
113 resp["X-Foo-Exists"] = "no";
114 }
115
116 string secret = cripts::File::Line::Reader(p2);
117 CDebug("Read secret = {}", secret);
118
119 if (resp.status == 200) {
120 resp.status = 222;
121 }
122
123 CDebug("Txn count: {}", conn.Count());
124}
125
126do_remap()
127{

Callers

nothing calls this directly

Calls 9

ReaderClass · 0.85
ASNMethod · 0.80
ASNNameMethod · 0.80
CountryMethod · 0.80
CountryCodeMethod · 0.80
StatusClass · 0.50
LogMethod · 0.45
typeMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected