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

Method getData

plugins/esi/fetcher/HttpDataFetcherImpl.cc:278–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276}
277
278bool
279HttpDataFetcherImpl::getData(const string &url, ResponseData &resp_data) const
280{
281 UrlToContentMap::const_iterator iter = _pages.find(url);
282
283 if (iter == _pages.end()) {
284 TSError("[HttpDataFetcherImpl]Content being requested for unregistered URL [%s]", url.data());
285 return false;
286 }
287 const RequestData &req_data = iter->second; // handy reference
288 if (!req_data.complete) {
289 // request not completed yet
290 TSError("[HttpDataFetcherImpl]Request for URL [%s] not complete", url.data());
291 return false;
292 }
293 if (req_data.response.empty()) {
294 // did not receive valid data
295 TSError("[HttpDataFetcherImpl]No valid data received for URL [%s]; returning empty data to be safe", url.data());
296 resp_data.clear();
297 return false;
298 }
299
300 resp_data.set(req_data.body, req_data.body_len, req_data.bufp, req_data.hdr_loc, req_data.resp_status);
301 DBG("[%s] Found data for URL [%s] of size %d starting with [%.5s]", __FUNCTION__, url.data(), req_data.body_len, req_data.body);
302 return true;
303}
304
305void
306HttpDataFetcherImpl::clear()

Callers

nothing calls this directly

Calls 7

TSErrorFunction · 0.50
findMethod · 0.45
endMethod · 0.45
dataMethod · 0.45
emptyMethod · 0.45
clearMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected