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

Function isInterceptRequest

plugins/esi/esi.cc:1381–1416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1379}
1380
1381static bool
1382isInterceptRequest(TSHttpTxn txnp)
1383{
1384 if (!TSHttpTxnIsInternal(txnp)) {
1385 Dbg(dbg_ctl_local, "[%s] Skipping external request", __FUNCTION__);
1386 return false;
1387 }
1388
1389 TSMBuffer bufp;
1390 TSMLoc hdr_loc;
1391 if (TSHttpTxnClientReqGet(txnp, &bufp, &hdr_loc) != TS_SUCCESS) {
1392 TSError("[esi][%s] Could not get client request", __FUNCTION__);
1393 return false;
1394 }
1395
1396 bool valid_request = false;
1397 bool retval = false;
1398 int method_len;
1399 const char *method = TSHttpHdrMethodGet(bufp, hdr_loc, &method_len);
1400 if (!method) {
1401 TSError("[esi][%s] Could not obtain method!", __FUNCTION__);
1402 } else {
1403 if ((method_len != TS_HTTP_LEN_POST) || (strncasecmp(method, TS_HTTP_METHOD_POST, TS_HTTP_LEN_POST))) {
1404 Dbg(dbg_ctl_local, "[%s] Method [%.*s] invalid, [%s] expected", __FUNCTION__, method_len, method, TS_HTTP_METHOD_POST);
1405 } else {
1406 Dbg(dbg_ctl_local, "[%s] Valid server intercept method found", __FUNCTION__);
1407 valid_request = true;
1408 }
1409 }
1410
1411 if (valid_request) {
1412 retval = checkHeaderValue(bufp, hdr_loc, SERVER_INTERCEPT_HEADER, SERVER_INTERCEPT_HEADER_LEN);
1413 }
1414 TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
1415 return retval;
1416}
1417
1418static bool
1419checkForCacheHeader(const char *name, int name_len, const char *value, int value_len, bool &cacheable)

Callers 2

globalHookHandlerFunction · 0.85
TSRemapDoRemapFunction · 0.85

Calls 6

TSHttpTxnIsInternalFunction · 0.85
TSHttpTxnClientReqGetFunction · 0.85
TSHttpHdrMethodGetFunction · 0.85
checkHeaderValueFunction · 0.85
TSHandleMLocReleaseFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected