Continuation function to delete the x-debug header.
| 786 | // Continuation function to delete the x-debug header. |
| 787 | // |
| 788 | static int |
| 789 | XDeleteDebugHdr(TSCont /* contp */, TSEvent event, void *edata) |
| 790 | { |
| 791 | TSHttpTxn txn = static_cast<TSHttpTxn>(edata); |
| 792 | TSMLoc hdr, field; |
| 793 | TSMBuffer buffer; |
| 794 | |
| 795 | // Make sure TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE) is called before exiting function. |
| 796 | // |
| 797 | ts::PostScript ps([=]() -> void { TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE); }); |
| 798 | |
| 799 | TSReleaseAssert(event == TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE); |
| 800 | |
| 801 | if (TSHttpTxnClientReqGet(txn, &buffer, &hdr) == TS_ERROR) { |
| 802 | return TS_EVENT_NONE; |
| 803 | } |
| 804 | |
| 805 | field = TSMimeHdrFieldFind(buffer, hdr, xDebugHeader.str, xDebugHeader.len); |
| 806 | if (field == TS_NULL_MLOC) { |
| 807 | return TS_EVENT_NONE; |
| 808 | } |
| 809 | |
| 810 | if (TSMimeHdrFieldDestroy(buffer, hdr, field) == TS_ERROR) { |
| 811 | TSError("Failure destroying %s header", xDebugHeader.str); |
| 812 | } |
| 813 | |
| 814 | TSHandleMLocRelease(buffer, hdr, field); |
| 815 | |
| 816 | return TS_EVENT_NONE; |
| 817 | } |
| 818 | |
| 819 | static void |
| 820 | updateAllowedHeaders(const char *optarg) |
nothing calls this directly
no test coverage detected