| 532 | } |
| 533 | |
| 534 | static int |
| 535 | XInjectResponseHeaders(TSCont /* contp */, TSEvent event, void *edata) |
| 536 | { |
| 537 | TSHttpTxn txn = static_cast<TSHttpTxn>(edata); |
| 538 | TSMBuffer buffer; |
| 539 | TSMLoc hdr; |
| 540 | |
| 541 | TSReleaseAssert(event == TS_EVENT_HTTP_SEND_RESPONSE_HDR); |
| 542 | |
| 543 | unsigned xheaders = AuxDataMgr::data(txn).xheaders; |
| 544 | if (xheaders == 0) { |
| 545 | goto done; |
| 546 | } |
| 547 | |
| 548 | if (TSHttpTxnClientRespGet(txn, &buffer, &hdr) == TS_ERROR) { |
| 549 | goto done; |
| 550 | } |
| 551 | |
| 552 | if (xheaders & XHEADER_X_CACHE_KEY) { |
| 553 | InjectCacheKeyHeader(txn, buffer, hdr); |
| 554 | } |
| 555 | |
| 556 | if (xheaders & XHEADER_X_CACHE_INFO) { |
| 557 | InjectCacheInfoHeader(txn, buffer, hdr); |
| 558 | } |
| 559 | |
| 560 | if (xheaders & XHEADER_X_CACHE) { |
| 561 | InjectCacheHeader(txn, buffer, hdr); |
| 562 | } |
| 563 | |
| 564 | if (xheaders & XHEADER_X_MILESTONES) { |
| 565 | InjectMilestonesHeader(txn, buffer, hdr); |
| 566 | } |
| 567 | |
| 568 | if (xheaders & XHEADER_X_GENERATION) { |
| 569 | InjectGenerationHeader(txn, buffer, hdr); |
| 570 | } |
| 571 | |
| 572 | if (xheaders & XHEADER_X_TRANSACTION_ID) { |
| 573 | InjectTxnUuidHeader(txn, buffer, hdr); |
| 574 | } |
| 575 | |
| 576 | if (xheaders & XHEADER_X_REMAP) { |
| 577 | InjectRemapHeader(txn, buffer, hdr); |
| 578 | } |
| 579 | |
| 580 | if (xheaders & XHEADER_X_EFFECTIVE_URL) { |
| 581 | InjectEffectiveURLHeader(txn, buffer, hdr); |
| 582 | } |
| 583 | |
| 584 | // intentionally placed after all injected headers. |
| 585 | |
| 586 | if (xheaders & XHEADER_X_DUMP_HEADERS) { |
| 587 | log_headers(txn, buffer, hdr, "ClientResponse"); |
| 588 | } |
| 589 | |
| 590 | if (xheaders & XHEADER_X_PROBE_HEADERS) { |
| 591 | InjectOriginalContentTypeHeader(buffer, hdr); |
nothing calls this directly
no test coverage detected