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

Function do_remap

example/cripts/example1.cc:126–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126do_remap()
127{
128 auto now = cripts::Time::Local::Now();
129 borrow req = cripts::Client::Request::Get();
130 borrow conn = cripts::Client::Connection::Get();
131 auto ip = conn.IP();
132
133 if (CRIPT_ALLOW.contains(ip)) {
134 CDebug("Client IP allowed: {}", ip.string(24, 64));
135 }
136
137 CDebug("Epoch time is {} (or via .epoch(), {}", now, now.Epoch());
138 CDebug("Year is {}", now.Year());
139 CDebug("Month is {}", now.Month());
140 CDebug("Day is {}", now.Day());
141 CDebug("Hour is {}", now.Hour());
142 CDebug("Day number is {}", now.YearDay());
143
144 CDebug("from_url = {}", instance.from_url.c_str());
145 CDebug("to_url = {}", instance.to_url.c_str());
146
147 // Turn off the cache for testing
148 // proxy.config.http.cache.http.set(1);
149 // control.cache.nostore.set(true);
150
151 CDebug("Int config cache.http = {}", proxy.config.http.cache.http.Get());
152 CDebug("Float config cache.heuristic_lm_factor = {}", proxy.config.http.cache.heuristic_lm_factor.Get());
153 CDebug("String config http.response_server_str = {}", proxy.config.http.response_server_str.GetSV(context));
154 CDebug("X-Miles = {}", req["X-Miles"]);
155 CDebug("random(1000) = {}", cripts::Random(1000));
156
157 borrow url = cripts::Client::URL::Get();
158 auto old_port = url.port;
159
160 CDebug("Method is {}", req.method);
161 CDebug("Scheme is {}", url.scheme);
162 CDebug("Host is {}", url.host);
163 CDebug("Port is {}", url.port);
164 CDebug("Path is {}", url.path);
165 CDebug("Path[1] is {}", url.path[1]);
166 CDebug("Query is {}", url.query);
167
168 auto testing_trim = url.path.trim();
169
170 CDebug("Trimmed path is {}", testing_trim);
171
172 if (url.query["foo"] > 100) {
173 CDebug("Query[foo] is > 100");
174 }
175
176 if (url.path == "some/url" || url.path[0] == "other") {
177 CDebug("The path comparison triggered");
178 }
179
180 url.host = "foobar.com";
181 url.port = "81";
182 url.port = old_port;
183

Callers

nothing calls this directly

Calls 15

RandomClass · 0.85
EpochMethod · 0.80
YearMethod · 0.80
MonthMethod · 0.80
DayMethod · 0.80
HourMethod · 0.80
YearDayMethod · 0.80
IncrementMethod · 0.80
GaugeClass · 0.50
CounterClass · 0.50
IPMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected