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

Method gather

plugins/header_rewrite/resources.cc:32–158  ·  view source on GitHub ↗

Collect all resources

Source from the content-addressed store, hash-verified

30
31// Collect all resources
32void
33Resources::gather(const ResourceIDs ids, TSHttpHookID hook)
34{
35 Dbg(pi_dbg_ctl, "Building resources, hook=%s", TSHttpHookNameLookup(hook));
36
37 Dbg(pi_dbg_ctl, "Gathering resources for hook %s with IDs %d", TSHttpHookNameLookup(hook), ids);
38
39 // If we need the client request headers, make sure it's also available in the client vars.
40 if (ids & RSRC_CLIENT_REQUEST_HEADERS) {
41 Dbg(pi_dbg_ctl, "\tAdding TXN client request header buffers");
42 if (TSHttpTxnClientReqGet(state.txnp, &client_bufp, &client_hdr_loc) != TS_SUCCESS) {
43 Dbg(pi_dbg_ctl, "could not gather bufp/hdr_loc for request");
44 return;
45 }
46 }
47
48 switch (hook) {
49 case TS_HTTP_READ_RESPONSE_HDR_HOOK:
50 // Read response headers from server
51 if ((ids & RSRC_SERVER_RESPONSE_HEADERS) || (ids & RSRC_RESPONSE_STATUS)) {
52 Dbg(pi_dbg_ctl, "\tAdding TXN server response header buffers");
53 if (TSHttpTxnServerRespGet(state.txnp, &bufp, &hdr_loc) != TS_SUCCESS) {
54 Dbg(pi_dbg_ctl, "could not gather bufp/hdr_loc for response");
55 return;
56 }
57 if (ids & RSRC_RESPONSE_STATUS) {
58 Dbg(pi_dbg_ctl, "\tAdding TXN server response status resource");
59 resp_status = TSHttpHdrStatusGet(bufp, hdr_loc);
60 }
61 }
62 break;
63
64 case TS_HTTP_SEND_REQUEST_HDR_HOOK:
65 Dbg(pi_dbg_ctl, "Processing TS_HTTP_SEND_REQUEST_HDR_HOOK");
66 // Read request headers to server
67 if (ids & RSRC_SERVER_REQUEST_HEADERS) {
68 Dbg(pi_dbg_ctl, "\tAdding TXN server request header buffers");
69 if (TSHttpTxnServerReqGet(state.txnp, &bufp, &hdr_loc) != TS_SUCCESS) {
70 Dbg(pi_dbg_ctl, "could not gather bufp/hdr_loc for request");
71 return;
72 }
73 }
74 break;
75
76 case TS_HTTP_READ_REQUEST_HDR_HOOK:
77 case TS_HTTP_PRE_REMAP_HOOK:
78 // Read request from client
79 if (ids & RSRC_CLIENT_REQUEST_HEADERS) {
80 bufp = client_bufp;
81 hdr_loc = client_hdr_loc;
82 }
83 break;
84
85 case TS_HTTP_SEND_RESPONSE_HDR_HOOK:
86 // Send response headers to client
87 if (ids & RSRC_CLIENT_RESPONSE_HEADERS) {
88 Dbg(pi_dbg_ctl, "\tAdding TXN client response header buffers");
89 if (TSHttpTxnClientRespGet(state.txnp, &bufp, &hdr_loc) != TS_SUCCESS) {

Callers 3

run_grpc_clientsFunction · 0.80
cont_rewrite_headersFunction · 0.80
TSRemapDoRemapFunction · 0.80

Calls 7

TSHttpHookNameLookupFunction · 0.85
TSHttpTxnClientReqGetFunction · 0.85
TSHttpTxnServerRespGetFunction · 0.85
TSHttpHdrStatusGetFunction · 0.85
TSHttpTxnServerReqGetFunction · 0.85
TSHttpTxnClientRespGetFunction · 0.85
set_stateMethod · 0.45

Tested by

no test coverage detected