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

Method HandlePushResponseHdr

src/proxy/http/HttpTransact.cc:2257–2285  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////// Name : HandlePushResponseHdr Description: Details : Called after reading the response header on PUSH request /////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

2255// Called after reading the response header on PUSH request
2256//////////////////////////////////////////////////////////////////////////////
2257void
2258HttpTransact::HandlePushResponseHdr(State *s)
2259{
2260 // Verify the pushed header wasn't longer than the content length
2261 int64_t body_bytes = s->hdr_info.request_content_length - s->state_machine->pushed_response_hdr_bytes;
2262 if (body_bytes < 0) {
2263 HandlePushError(s, "Bad Content Length");
2264 return;
2265 }
2266 // We need to create the request header storing in the cache
2267 s->hdr_info.server_request.create(HTTP_TYPE_REQUEST);
2268 s->hdr_info.server_request.copy(&s->hdr_info.client_request);
2269 s->hdr_info.server_request.method_set(HTTP_METHOD_GET, HTTP_LEN_GET);
2270 s->hdr_info.server_request.value_set("X-Inktomi-Source", 16, "http PUSH", 9);
2271
2272 dump_header(dbg_ctl_http_hdrs, &s->hdr_info.server_response, s->state_machine_id(), "Pushed Response Header");
2273
2274 dump_header(dbg_ctl_http_hdrs, &s->hdr_info.server_request, s->state_machine_id(), "Generated Request Header");
2275
2276 s->response_received_time = s->request_sent_time = ink_local_time();
2277
2278 if (is_response_cacheable(s, &s->hdr_info.server_request, &s->hdr_info.server_response)) {
2279 ink_assert(s->cache_info.action == CACHE_PREPARE_TO_WRITE || s->cache_info.action == CACHE_PREPARE_TO_UPDATE);
2280
2281 TRANSACT_RETURN(SM_ACTION_CACHE_ISSUE_WRITE, HandlePushCacheWrite);
2282 } else {
2283 HandlePushError(s, "Response Not Cacheable");
2284 }
2285}
2286
2287//////////////////////////////////////////////////////////////////////////////
2288// Name : HandlePushCacheWrite

Callers

nothing calls this directly

Calls 7

dump_headerFunction · 0.85
ink_local_timeFunction · 0.85
method_setMethod · 0.80
state_machine_idMethod · 0.80
createMethod · 0.45
copyMethod · 0.45
value_setMethod · 0.45

Tested by

no test coverage detected