| 1379 | } |
| 1380 | |
| 1381 | static bool |
| 1382 | isInterceptRequest(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 | |
| 1418 | static bool |
| 1419 | checkForCacheHeader(const char *name, int name_len, const char *value, int value_len, bool &cacheable) |
no test coverage detected