~ps10gel/ubuntu/xenial/trafficserver/6.2.0

« back to all changes in this revision

Viewing changes to plugins/experimental/esi/fetcher/HttpDataFetcherImpl.cc

  • Committer: Package Import Robot
  • Author(s): Aron Xu
  • Date: 2013-05-09 01:00:04 UTC
  • mto: (1.1.11) (5.3.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: package-import@ubuntu.com-20130509010004-9fqq9n0adseg3f8w
Tags: upstream-3.3.2
ImportĀ upstreamĀ versionĀ 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 */
23
23
 
24
24
#include "HttpDataFetcherImpl.h"
25
 
#include "Utils.h"
26
 
#include "gzip.h"
 
25
#include "lib/Utils.h"
 
26
#include "lib/gzip.h"
27
27
 
28
28
#include <arpa/inet.h>
29
29
 
112
112
  base_event_id = _getBaseEventId(event);
113
113
  if ((base_event_id < 0) || (base_event_id >= static_cast<int>(_page_entry_lookup.size()))) {
114
114
    TSDebug(_debug_tag, "[%s] Event id %d not within fetch event id range [%d, %ld)",
115
 
             __FUNCTION__, event, FETCH_EVENT_ID_BASE, FETCH_EVENT_ID_BASE + (_page_entry_lookup.size() * 3));
 
115
             __FUNCTION__, event, FETCH_EVENT_ID_BASE,
 
116
             static_cast<long int>(FETCH_EVENT_ID_BASE + (_page_entry_lookup.size() * 3)));
116
117
    return false;
117
118
  }
118
119
  return true;
158
159
  TSHttpParserClear(_http_parser);
159
160
  
160
161
  if (TSHttpHdrParseResp(_http_parser, req_data.bufp, req_data.hdr_loc, &startptr, endptr) == TS_PARSE_DONE) {
161
 
    TSHttpStatus resp_status = TSHttpHdrStatusGet(req_data.bufp, req_data.hdr_loc);
162
 
    if (resp_status == TS_HTTP_STATUS_OK) {
163
 
      valid_data_received = true;
 
162
    req_data.resp_status = TSHttpHdrStatusGet(req_data.bufp, req_data.hdr_loc);
 
163
    valid_data_received = true;
 
164
    if (req_data.resp_status == TS_HTTP_STATUS_OK) {
164
165
      req_data.body_len = endptr - startptr;
165
166
      req_data.body = startptr;
166
167
      TSDebug(_debug_tag,
191
192
 
192
193
    } else {
193
194
      TSDebug(_debug_tag, "[%s] Received non-OK status %d for request [%s]",
194
 
               __FUNCTION__, resp_status, req_str.data());
195
 
    } 
 
195
               __FUNCTION__, req_data.resp_status, req_str.data());
 
196
    }
196
197
  } else {
197
198
    TSDebug(_debug_tag, "[%s] Could not parse response for request [%s]",
198
199
             __FUNCTION__, req_str.data());
289
290
    TSError("Status being requested for unregistered URL [%s]", url.data());
290
291
    return STATUS_ERROR;
291
292
  }
 
293
 
292
294
  if (!(iter->second).complete) {
293
295
    return STATUS_DATA_PENDING;
294
296
  }
295
 
  if ((iter->second).response.empty()) {
 
297
 
 
298
  if ((iter->second).resp_status != TS_HTTP_STATUS_OK) {
296
299
    return STATUS_ERROR;
297
300
  }
 
301
 
298
302
  return STATUS_DATA_AVAILABLE;
299
303
}
300
304
 
318
322
      return;
319
323
  }
320
324
 
 
325
  // should not support keep-alive for async requests
 
326
  if (Utils::areEqual(header.name, header.name_len,
 
327
              TS_MIME_FIELD_PROXY_CONNECTION, TS_MIME_LEN_PROXY_CONNECTION)) {
 
328
      return;
 
329
  }
 
330
 
321
331
  _headers_str.append(header.name, header.name_len);
322
332
  _headers_str.append(": ");
323
333
  _headers_str.append(header.value, header.value_len);