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

Function logSliceError

plugins/slice/server.cc:271–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271void
272logSliceError(char const *const message, Data const *const data, HttpHeader const &header_resp)
273{
274 Config *const conf = data->m_config;
275
276 bool const logToError = conf->canLogError();
277
278 // always write block stitch errors while in debug mode
279 if (!logToError && !dbg_ctl.on()) {
280 return;
281 }
282
283 HttpHeader const header_req(data->m_req_hdrmgr.m_buffer, data->m_req_hdrmgr.m_lochdr);
284
285 TSHRTime const timenowus = TShrtime();
286 int64_t const msecs = timenowus / 1000000;
287 int64_t const secs = msecs / 1000;
288 int64_t const ms = msecs % 1000;
289
290 // Gather information on the request, must delete urlstr
291 int urllen = 0;
292 char *const urlstr = header_req.urlString(&urllen);
293
294 char urlpstr[16384];
295 size_t urlplen = sizeof(urlpstr);
296 TSStringPercentEncode(urlstr, urllen, urlpstr, urlplen, &urlplen, nullptr);
297
298 if (nullptr != urlstr) {
299 TSfree(urlstr);
300 }
301
302 // uas
303 char uasstr[8192];
304 int uaslen = sizeof(uasstr);
305 header_req.valueForKey(TS_MIME_FIELD_USER_AGENT, TS_MIME_LEN_USER_AGENT, uasstr, &uaslen);
306
307 // raw range request
308 char rangestr[1024];
309 int rangelen = sizeof(rangestr);
310 header_req.valueForKey(conf->m_skip_header.data(), conf->m_skip_header.size(), rangestr, &rangelen);
311
312 // Normalized range request
313 ContentRange const crange(data->m_req_range.m_beg, data->m_req_range.m_end, data->m_contentlen);
314 char normstr[1024];
315 int normlen = sizeof(normstr);
316 crange.toStringClosed(normstr, &normlen);
317
318 // block range request
319 int64_t const blockbeg = data->m_blocknum * conf->m_blockbytes;
320 int64_t const blockend = std::min(blockbeg + conf->m_blockbytes, data->m_contentlen);
321
322 // Block response data
323 TSHttpStatus const statusgot = header_resp.status();
324
325 // content range
326 char crstr[1024];
327 int crlen = sizeof(crstr);
328 header_resp.valueForKey(TS_MIME_FIELD_CONTENT_RANGE, TS_MIME_LEN_CONTENT_RANGE, crstr, &crlen);

Callers 1

handleNextServerHeaderFunction · 0.85

Calls 12

TShrtimeFunction · 0.85
TSStringPercentEncodeFunction · 0.85
TSfreeFunction · 0.85
canLogErrorMethod · 0.80
urlStringMethod · 0.80
valueForKeyMethod · 0.80
timeForKeyMethod · 0.80
onMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
toStringClosedMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected