HttpRequest.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 /* DEBUG: section 73 HTTP Request */
10 
11 #include "squid.h"
12 #include "AccessLogEntry.h"
13 #include "acl/AclSizeLimit.h"
14 #include "acl/FilledChecklist.h"
15 #include "client_side.h"
16 #include "client_side_request.h"
17 #include "dns/LookupDetails.h"
18 #include "Downloader.h"
19 #include "err_detail_type.h"
20 #include "globals.h"
21 #include "gopher.h"
22 #include "http.h"
23 #include "http/one/RequestParser.h"
24 #include "http/Stream.h"
25 #include "HttpHdrCc.h"
26 #include "HttpHeaderRange.h"
27 #include "HttpRequest.h"
28 #include "log/Config.h"
29 #include "MemBuf.h"
30 #include "sbuf/StringConvert.h"
31 #include "SquidConfig.h"
32 #include "Store.h"
33 #include "URL.h"
34 
35 #if USE_AUTH
36 #include "auth/UserRequest.h"
37 #endif
38 #if ICAP_CLIENT
40 #endif
41 
43  Http::Message(hoRequest),
44  masterXaction(mx)
45 {
46  assert(mx);
47  init();
48 }
49 
50 HttpRequest::HttpRequest(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aSchemeImg, const char *aUrlpath, const MasterXaction::Pointer &mx) :
51  Http::Message(hoRequest),
52  masterXaction(mx)
53 {
54  assert(mx);
55  static unsigned int id = 1;
56  debugs(93,7, HERE << "constructed, this=" << this << " id=" << ++id);
57  init();
58  initHTTP(aMethod, aProtocol, aSchemeImg, aUrlpath);
59 }
60 
62 {
63  clean();
64  debugs(93,7, HERE << "destructed, this=" << this);
65 }
66 
67 void
68 HttpRequest::initHTTP(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aSchemeImg, const char *aUrlpath)
69 {
70  method = aMethod;
71  url.setScheme(aProtocol, aSchemeImg);
72  url.path(aUrlpath);
73 }
74 
75 void
77 {
79  url.clear();
80 #if USE_AUTH
82 #endif
83  memset(&flags, '\0', sizeof(flags));
84  range = NULL;
85  ims = -1;
86  imslen = 0;
87  lastmod = -1;
89  my_addr.setEmpty();
90  body_pipe = NULL;
91  // hier
92  dnsWait = -1;
93  errType = ERR_NONE;
95  peer_login = NULL; // not allocated/deallocated by this class
96  peer_domain = NULL; // not allocated/deallocated by this class
97  peer_host = NULL;
98  vary_headers = SBuf();
100  tag = null_string;
101 #if USE_AUTH
104 #endif
108 #if FOLLOW_X_FORWARDED_FOR
110 #endif /* FOLLOW_X_FORWARDED_FOR */
111 #if USE_ADAPTATION
113 #endif
114 #if ICAP_CLIENT
115  icapHistory_ = NULL;
116 #endif
117  rangeOffsetLimit = -2; //a value of -2 means not checked yet
118  forcedBodyContinuation = false;
119 }
120 
121 void
123 {
124  // we used to assert that the pipe is NULL, but now the request only
125  // points to a pipe that is owned and initiated by another object.
126  body_pipe = NULL;
127 #if USE_AUTH
129 #endif
131  url.clear();
132 
133  header.clean();
134 
135  if (cache_control) {
136  delete cache_control;
138  }
139 
140  if (range) {
141  delete range;
142  range = NULL;
143  }
144 
145  myportname.clean();
146 
147  theNotes = nullptr;
148 
149  tag.clean();
150 #if USE_AUTH
151  extacl_user.clean();
153 #endif
154  extacl_log.clean();
155 
157 
158  etag.clean();
159 
160 #if USE_ADAPTATION
162 #endif
163 #if ICAP_CLIENT
164  icapHistory_ = NULL;
165 #endif
166 }
167 
168 void
170 {
171  clean();
172  init();
173 }
174 
175 HttpRequest *
177 {
179  copy->method = method;
180  // TODO: move common cloning clone to Msg::copyTo() or copy ctor
181  copy->header.append(&header);
182  copy->hdrCacheInit();
183  copy->hdr_sz = hdr_sz;
184  copy->http_ver = http_ver;
185  copy->pstate = pstate; // TODO: should we assert a specific state here?
186  copy->body_pipe = body_pipe;
187 
188  copy->url = url;
189 
190  // range handled in hdrCacheInit()
191  copy->ims = ims;
192  copy->imslen = imslen;
193  copy->hier = hier; // Is it safe to copy? Should we?
194 
195  copy->errType = errType;
196 
197  // XXX: what to do with copy->peer_login?
198 
199  copy->lastmod = lastmod;
200  copy->etag = etag;
201  copy->vary_headers = vary_headers;
202  // XXX: what to do with copy->peer_domain?
203 
204  copy->tag = tag;
205  copy->extacl_log = extacl_log;
207 
208  const bool inheritWorked = copy->inheritProperties(this);
209  assert(inheritWorked);
210 
211  return copy;
212 }
213 
214 bool
216 {
217  const HttpRequest* aReq = dynamic_cast<const HttpRequest*>(aMsg);
218  if (!aReq)
219  return false;
220 
221  client_addr = aReq->client_addr;
222 #if FOLLOW_X_FORWARDED_FOR
224 #endif
225  my_addr = aReq->my_addr;
226 
227  dnsWait = aReq->dnsWait;
228 
229 #if USE_ADAPTATION
230  adaptHistory_ = aReq->adaptHistory();
231 #endif
232 #if ICAP_CLIENT
233  icapHistory_ = aReq->icapHistory();
234 #endif
235 
236  // This may be too conservative for the 204 No Content case
237  // may eventually need cloneNullAdaptationImmune() for that.
239 
240  errType = aReq->errType;
241  errDetail = aReq->errDetail;
242 #if USE_AUTH
244  extacl_user = aReq->extacl_user;
246 #endif
247 
248  myportname = aReq->myportname;
249 
251 
252  // main property is which connection the request was received on (if any)
254 
255  downloader = aReq->downloader;
256 
257  theNotes = aReq->theNotes;
258 
259  sources = aReq->sources;
260  return true;
261 }
262 
269 bool
270 HttpRequest::sanityCheckStartLine(const char *buf, const size_t hdr_len, Http::StatusCode *error)
271 {
272  // content is long enough to possibly hold a reply
273  // 2 being magic size of a 1-byte request method plus space delimiter
274  if (hdr_len < 2) {
275  // this is ony a real error if the headers apparently complete.
276  if (hdr_len > 0) {
277  debugs(58, 3, HERE << "Too large request header (" << hdr_len << " bytes)");
278  *error = Http::scInvalidHeader;
279  }
280  return false;
281  }
282 
283  /* See if the request buffer starts with a non-whitespace HTTP request 'method'. */
285  m.HttpRequestMethodXXX(buf);
286  if (m == Http::METHOD_NONE) {
287  debugs(73, 3, "HttpRequest::sanityCheckStartLine: did not find HTTP request method");
288  *error = Http::scInvalidHeader;
289  return false;
290  }
291 
292  return true;
293 }
294 
295 bool
296 HttpRequest::parseFirstLine(const char *start, const char *end)
297 {
299 
300  if (method == Http::METHOD_NONE)
301  return false;
302 
303  // XXX: performance regression, strcspn() over the method bytes a second time.
304  // cheaper than allocate+copy+deallocate cycle to SBuf convert a piece of start.
305  const char *t = start + strcspn(start, w_space);
306 
307  start = t + strspn(t, w_space); // skip w_space after method
308 
309  const char *ver = findTrailingHTTPVersion(start, end);
310 
311  if (ver) {
312  end = ver - 1;
313 
314  while (xisspace(*end)) // find prev non-space
315  --end;
316 
317  ++end; // back to space
318 
319  if (2 != sscanf(ver + 5, "%d.%d", &http_ver.major, &http_ver.minor)) {
320  debugs(73, DBG_IMPORTANT, "parseRequestLine: Invalid HTTP identifier.");
321  return false;
322  }
323  } else {
324  http_ver.major = 0;
325  http_ver.minor = 9;
326  }
327 
328  if (end < start) // missing URI
329  return false;
330 
331  char save = *end;
332 
333  * (char *) end = '\0'; // temp terminate URI, XXX dangerous?
334 
335  const bool ret = url.parse(method, start);
336 
337  * (char *) end = save;
338 
339  return ret;
340 }
341 
342 /* swaps out request using httpRequestPack */
343 void
345 {
346  assert(e);
347  e->buffer();
348  pack(e);
349  e->flush();
350 }
351 
352 /* packs request-line and headers, appends <crlf> terminator */
353 void
355 {
356  assert(p);
357  /* pack request-line */
358  p->appendf(SQUIDSBUFPH " " SQUIDSBUFPH " HTTP/%d.%d\r\n",
361  /* headers */
362  header.packInto(p);
363  /* trailer */
364  p->append("\r\n", 2);
365 }
366 
367 /*
368  * A wrapper for debugObj()
369  */
370 void
372 {
373  HttpRequest *request = static_cast<HttpRequest*>(obj);
374  request->pack(p);
375 }
376 
377 /* returns the length of request line + headers + crlf */
378 int
380 {
381  return method.image().length() + 1 +
382  url.path().length() + 1 +
383  4 + 1 + 3 + 2 +
384  header.len + 2;
385 }
386 
387 /* sync this routine when you update HttpRequest struct */
388 void
390 {
392 
393  assert(!range);
394  range = header.getRange();
395 }
396 
397 #if ICAP_CLIENT
400 {
401  if (!icapHistory_) {
402  if (Log::TheConfig.hasIcapToken || IcapLogfileStatus == LOG_ENABLE) {
404  debugs(93,4, HERE << "made " << icapHistory_ << " for " << this);
405  }
406  }
407 
408  return icapHistory_;
409 }
410 #endif
411 
412 #if USE_ADAPTATION
414 HttpRequest::adaptHistory(bool createIfNone) const
415 {
416  if (!adaptHistory_ && createIfNone) {
418  debugs(93,4, HERE << "made " << adaptHistory_ << " for " << this);
419  }
420 
421  return adaptHistory_;
422 }
423 
426 {
427  return HttpRequest::adaptHistory(Log::TheConfig.hasAdaptToken);
428 }
429 
430 void
432 {
433  if (!adaptHistory_) {
434  adaptHistory_ = them.adaptHistory_; // may be nil
435  } else {
436  // check that histories did not diverge
437  Must(!them.adaptHistory_ || them.adaptHistory_ == adaptHistory_);
438  }
439 }
440 
441 #endif
442 
443 bool
445 {
446  return (range && range->specs.size() > 1);
447 }
448 
449 bool
451 {
452  return body_pipe != NULL && body_pipe->consumedSize() > 0;
453 }
454 
455 void
457 {
458  if (errType || errDetail)
459  debugs(11, 5, HERE << "old error details: " << errType << '/' << errDetail);
460  debugs(11, 5, HERE << "current error details: " << aType << '/' << aDetail);
461  // checking type and detail separately may cause inconsistency, but
462  // may result in more details available if they only become available later
463  if (!errType)
464  errType = aType;
465  if (!errDetail)
466  errDetail = aDetail;
467 }
468 
469 void
471 {
472  debugs(11, 7, HERE << "old error details: " << errType << '/' << errDetail);
473  errType = ERR_NONE;
475 }
476 
477 void
479 {
480  const SBuf tmp(full_uri ? effectiveRequestUri() : url.path());
481 
482  // form HTTP request-line
483  p->appendf(SQUIDSBUFPH " " SQUIDSBUFPH " HTTP/%d.%d\r\n",
485  SQUIDSBUFPRINT(tmp),
487 }
488 
489 /*
490  * Indicate whether or not we would expect an entity-body
491  * along with this request
492  */
493 bool
494 HttpRequest::expectingBody(const HttpRequestMethod &, int64_t &theSize) const
495 {
496  bool expectBody = false;
497 
498  /*
499  * Note: Checks for message validity is in clientIsContentLengthValid().
500  * this just checks if a entity-body is expected based on HTTP message syntax
501  */
502  if (header.chunked()) {
503  expectBody = true;
504  theSize = -1;
505  } else if (content_length >= 0) {
506  expectBody = true;
507  theSize = content_length;
508  } else {
509  expectBody = false;
510  // theSize undefined
511  }
512 
513  return expectBody;
514 }
515 
516 /*
517  * Create a Request from a URL and METHOD.
518  *
519  * If the METHOD is CONNECT, then a host:port pair is looked for instead of a URL.
520  * If the request cannot be created cleanly, NULL is returned
521  */
522 HttpRequest *
524 {
525  std::unique_ptr<HttpRequest> req(new HttpRequest(mx));
526  if (req->url.parse(method, url)) {
527  req->method = method;
528  return req.release();
529  }
530  return nullptr;
531 }
532 
537 bool
539 {
540  // Intercepted request with Host: header which cannot be trusted.
541  // Because it failed verification, or someone bypassed the security tests
542  // we cannot cache the reponse for sharing between clients.
543  // TODO: update cache to store for particular clients only (going to same Host: and destination IP)
545  return false;
546 
547  switch (url.getScheme()) {
548  case AnyP::PROTO_HTTP:
549  case AnyP::PROTO_HTTPS:
550  if (!method.respMaybeCacheable())
551  return false;
552 
553  // RFC 7234 section 5.2.1.5:
554  // "cache MUST NOT store any part of either this request or any response to it"
555  //
556  // NP: refresh_pattern ignore-no-store only applies to response messages
557  // this test is handling request message CC header.
559  return false;
560  break;
561 
562  case AnyP::PROTO_GOPHER:
563  if (!gopherCachable(this))
564  return false;
565  break;
566 
568  return false;
569 
570  //case AnyP::PROTO_FTP:
571  default:
572  break;
573  }
574 
575  return true;
576 }
577 
578 bool
580 {
581  return flags.ims ||
584 }
585 
586 void
588 {
589  if (dns.wait >= 0) { // known delay
590  if (dnsWait >= 0) { // have recorded DNS wait before
591  debugs(78, 7, this << " " << dnsWait << " += " << dns);
592  dnsWait += dns.wait;
593  } else {
594  debugs(78, 7, this << " " << dns);
595  dnsWait = dns.wait;
596  }
597  }
598 }
599 
600 int64_t
602 {
603  /* -2 is the starting value of rangeOffsetLimit.
604  * If it is -2, that means we haven't checked it yet.
605  * Otherwise, return the current value */
606  if (rangeOffsetLimit != -2)
607  return rangeOffsetLimit;
608 
609  rangeOffsetLimit = 0; // default value for rangeOffsetLimit
610 
611  ACLFilledChecklist ch(NULL, this, NULL);
612  ch.src_addr = client_addr;
613  ch.my_addr = my_addr;
614 
615  for (AclSizeLimit *l = Config.rangeOffsetLimit; l; l = l -> next) {
616  /* if there is no ACL list or if the ACLs listed match use this limit value */
617  if (!l->aclList || ch.fastCheck(l->aclList).allowed()) {
618  debugs(58, 4, HERE << "rangeOffsetLimit=" << rangeOffsetLimit);
619  rangeOffsetLimit = l->size; // may be -1
620  break;
621  }
622  }
623 
624  return rangeOffsetLimit;
625 }
626 
627 void
628 HttpRequest::ignoreRange(const char *reason)
629 {
630  if (range) {
631  debugs(73, 3, static_cast<void*>(range) << " for " << reason);
632  delete range;
633  range = NULL;
634  }
635  // Some callers also reset isRanged but it may not be safe for all callers:
636  // isRanged is used to determine whether a weak ETag comparison is allowed,
637  // and that check should not ignore the Range header if it was present.
638  // TODO: Some callers also delete HDR_RANGE, HDR_REQUEST_RANGE. Should we?
639 }
640 
641 bool
643 {
644  // old clients do not support 1xx unless they sent Expect: 100-continue
645  // (we reject all other Http::HdrType::EXPECT values so just check for Http::HdrType::EXPECT)
647  return false;
648 
649  // others must support 1xx control messages
650  return true;
651 }
652 
655 {
657  return clientConnectionManager.get();
658  return NULL;
659 }
660 
661 const SBuf
663 {
664  if (store_id.size() != 0) {
665  debugs(73, 3, "sent back store_id: " << store_id);
666  return StringToSBuf(store_id);
667  }
668  debugs(73, 3, "sent back effectiveRequestUrl: " << effectiveRequestUri());
669  return effectiveRequestUri();
670 }
671 
672 const SBuf &
674 {
676  return url.authority(true); // host:port
677  return url.absolute();
678 }
679 
682 {
683  if (!theNotes)
684  theNotes = new NotePairs;
685  return theNotes;
686 }
687 
688 void
690 {
691  // Tag client connection if the helper responded with clt_conn_tag=tag.
692  const char *cltTag = "clt_conn_tag";
693  if (const char *connTag = helperNotes.findFirst(cltTag)) {
694  if (csd) {
695  csd->notes()->remove(cltTag);
696  csd->notes()->add(cltTag, connTag);
697  }
698  }
699  request.notes()->replaceOrAdd(&helperNotes);
700 }
701 
702 void
704 {
706 
708  return;
709 
711  if (port) {
712  myportname = port->name;
713  flags.ignoreCc = port->ignore_cc;
714  }
715 
716  if (auto clientConnection = clientConnectionManager->clientConnection) {
717  client_addr = clientConnection->remote; // XXX: remove request->client_addr member.
718 #if FOLLOW_X_FORWARDED_FOR
719  // indirect client gets stored here because it is an HTTP header result (from X-Forwarded-For:)
720  // not details about the TCP connection itself
721  indirect_client_addr = clientConnection->remote;
722 #endif /* FOLLOW_X_FORWARDED_FOR */
723  my_addr = clientConnection->local;
724 
725  flags.intercepted = ((clientConnection->flags & COMM_INTERCEPTION) != 0);
726  flags.interceptTproxy = ((clientConnection->flags & COMM_TRANSPARENT) != 0 ) ;
727  const bool proxyProtocolPort = port ? port->flags.proxySurrogate : false;
728  if (flags.interceptTproxy && !proxyProtocolPort) {
730  ACLFilledChecklist *checklist = new ACLFilledChecklist(Config.accessList.spoof_client_ip, this, clientConnection->rfc931);
731  checklist->al = al;
732  flags.spoofClientIp = checklist->fastCheck().allowed();
733  delete checklist;
734  } else
735  flags.spoofClientIp = true;
736  } else
737  flags.spoofClientIp = false;
738  }
739 }
740 
MasterXaction::Pointer masterXaction
the master transaction this request belongs to. Never nil.
Definition: HttpRequest.h:224
void recordLookup(const Dns::LookupDetails &detail)
Definition: HttpRequest.cc:587
HierarchyLogEntry hier
Definition: HttpRequest.h:145
AnyP::ProtocolVersion ProtocolVersion(unsigned int aMajor, unsigned int aMinor)
HTTP version label information.
int has(Http::HdrType id) const
Definition: HttpHeader.cc:1002
bool interceptTproxy
Set for requests handled by a "tproxy" port.
Definition: RequestFlags.h:68
void pack(Packable *p) const
Definition: HttpRequest.cc:354
err_type errType
Definition: HttpRequest.h:149
ConnStateData * pinnedConnection()
Definition: HttpRequest.cc:654
HttpHdrRange * range
Definition: HttpRequest.h:131
collects information about adaptations related to a master transaction
Definition: History.h:23
#define assert(EX)
Definition: assert.h:17
Ip::Address my_addr
Definition: HttpRequest.h:143
String extacl_log
Definition: HttpRequest.h:171
HttpRequest(const MasterXaction::Pointer &)
Definition: HttpRequest.cc:42
void UpdateRequestNotes(ConnStateData *csd, HttpRequest &request, NotePairs const &helperNotes)
Definition: HttpRequest.cc:689
HttpHdrCc * cache_control
Definition: Message.h:76
ParseState pstate
the current parsing state
Definition: Message.h:94
int errDetail
errType-specific detail about the transaction error
Definition: HttpRequest.h:150
SBuf vary_headers
The variant second-stage cache key. Generated from Vary header pattern for this request.
Definition: HttpRequest.h:159
int hdr_sz
Definition: Message.h:81
Adaptation::Icap::History::Pointer icapHistory_
per-HTTP transaction info
Definition: HttpRequest.h:110
void initHTTP(const HttpRequestMethod &aMethod, AnyP::ProtocolType aProtocol, const char *schemeImage, const char *aUrlpath)
Definition: HttpRequest.cc:68
Definition: SBuf.h:87
const char * null_string
bool canHandle1xx() const
whether the client is likely to be able to handle a 1xx reply
Definition: HttpRequest.cc:642
Ip::Address src_addr
HttpRequestMethod method
Definition: HttpRequest.h:102
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
void add(const SBuf &key, const SBuf &value)
Definition: Notes.cc:278
void error(char *format,...)
int IcapLogfileStatus
Definition: icap_log.cc:20
RequestFlags cloneAdaptationImmune() const
Definition: RequestFlags.cc:18
bool parse(const HttpRequestMethod &, const char *url)
Definition: url.cc:191
virtual void buffer()
Definition: store.cc:1707
representation of a class of Size-limit ACLs
Definition: AclSizeLimit.h:16
bool forcedBodyContinuation
whether we have responded with HTTP 100 or FTP 150 already
Definition: HttpRequest.h:183
AccessLogEntry::Pointer al
info for the future access.log, and external ACL
encapsulates DNS lookup results
Definition: LookupDetails.h:20
virtual void flush()
Definition: store.cc:1718
void clear()
Definition: SBuf.cc:190
#define COMM_INTERCEPTION
Definition: Connection.h:49
AnyP::ProtocolVersion http_ver
Definition: Message.h:72
#define xisspace(x)
Definition: xis.h:17
void replaceOrAdd(const NotePairs *src)
Definition: Notes.cc:356
HttpHdrRange * getRange() const
Definition: HttpHeader.cc:1263
char * p
Definition: membanger.c:43
time_t ims
Definition: HttpRequest.h:133
bool hostVerified
Definition: RequestFlags.h:66
size_type size() const
Definition: SquidString.h:71
const SBuf storeId()
Definition: HttpRequest.cc:662
const char * findTrailingHTTPVersion(const char *uriAndHTTPVersion, const char *end)
virtual void append(const char *buf, int size)=0
Appends a c-string to existing packed data.
#define w_space
uint64_t consumedSize() const
Definition: BodyPipe.h:111
int64_t rangeOffsetLimit
Definition: HttpRequest.h:236
void manager(const CbcPointer< ConnStateData > &aMgr, const AccessLogEntryPointer &al)
associates the request with a from-client connection manager
Definition: HttpRequest.cc:703
String extacl_message
Definition: HttpRequest.h:173
int gopherCachable(const HttpRequest *req)
Definition: gopher.cc:295
NotePairs::Pointer notes()
Definition: HttpRequest.cc:681
void append(const HttpHeader *src)
Definition: HttpHeader.cc:232
unsigned int major
major version number
size_type length() const
Returns the number of bytes stored in SBuf.
Definition: SBuf.h:405
StatusCode
Definition: StatusCode.h:20
String extacl_passwd
Definition: HttpRequest.h:169
String store_id
Definition: HttpRequest.h:127
void adaptHistoryImport(const HttpRequest &them)
Makes their history ours, throwing on conflicts.
Definition: HttpRequest.cc:431
int64_t content_length
Definition: Message.h:83
int wait
msecs spent waiting for the lookup (if any) or -1 (if none)
Definition: LookupDetails.h:30
void clear()
Definition: URL.h:46
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:123
Adaptation::History::Pointer adaptHistory(bool createIfNone=false) const
Returns possibly nil history, creating it if requested.
Definition: HttpRequest.cc:414
bool bodyNibbled() const
Definition: HttpRequest.cc:450
#define DBG_IMPORTANT
Definition: Debug.h:45
void swapOut(StoreEntry *e)
Definition: HttpRequest.cc:344
SBuf & authority(bool requirePort=false) const
Definition: url.cc:470
NotePairs::Pointer notes()
virtual HttpRequest * clone() const
Definition: HttpRequest.cc:176
Ip::Address client_addr
Definition: HttpRequest.h:137
virtual bool inheritProperties(const Http::Message *)
Definition: HttpRequest.cc:215
AnyP::UriScheme const & getScheme() const
Definition: URL.h:58
char * peer_host
Definition: HttpRequest.h:154
Cbc * valid() const
was set and is valid
Definition: CbcPointer.h:41
String tag
Definition: HttpRequest.h:165
const SBuf & effectiveRequestUri() const
RFC 7230 section 5.5 - Effective Request URI.
Definition: HttpRequest.cc:673
common parts of HttpRequest and HttpReply
Definition: Message.h:24
NotePairs::Pointer theNotes
Definition: HttpRequest.h:240
CbcPointer< ConnStateData > clientConnectionManager
Definition: HttpRequest.h:218
struct SquidConfig::@113 accessList
bool allowed() const
Definition: Acl.h:141
int prefixLen() const
Definition: HttpRequest.cc:379
std::vector< HttpHdrRangeSpec * > specs
void setEmpty()
Fast reset of the stored content to what would be after default constructor.
Definition: Address.cc:177
static int port
Definition: ldap_backend.cc:69
URL url
the request URI
Definition: HttpRequest.h:103
void clearError()
clear error details, useful for retries/repeats
Definition: HttpRequest.cc:470
void path(const char *p)
Definition: URL.h:77
static HttpRequest * FromUrl(const char *url, const MasterXaction::Pointer &, const HttpRequestMethod &method=Http::METHOD_GET)
Definition: HttpRequest.cc:523
void ignoreRange(const char *reason)
forgets about the cached Range header (for a reason)
Definition: HttpRequest.cc:628
virtual void reset()
Definition: HttpRequest.cc:169
void const char * buf
Definition: stub_helper.cc:16
std::ostream & HERE(std::ostream &s)
Definition: Debug.h:147
collects information about ICAP processing related to an HTTP transaction
Definition: History.h:23
#define Must(cond)
Definition: TextException.h:89
HttpHeader header
Definition: Message.h:74
Adaptation::History::Pointer adaptLogHistory() const
Returns possibly nil history, creating it if adapt. logging is enabled.
Definition: HttpRequest.cc:425
Http::MethodType id() const
Definition: RequestMethod.h:73
RequestFlags flags
Definition: HttpRequest.h:129
Adaptation::Icap::History::Pointer icapHistory() const
Returns possibly nil history, creating it if icap logging is enabled.
Definition: HttpRequest.cc:399
const SBuf & image() const
bool maybeCacheable()
Definition: HttpRequest.cc:538
void setScheme(const AnyP::ProtocolType &p, const char *str)
convert the URL scheme to that given
Definition: URL.h:61
bool parseFirstLine(const char *start, const char *end)
Definition: HttpRequest.cc:296
#define LOG_ENABLE
Definition: defines.h:99
#define COMM_TRANSPARENT
Definition: Connection.h:48
allow_t const & fastCheck()
Definition: Checklist.cc:336
CbcPointer< Downloader > downloader
The Downloader object which initiated the HTTP request if any.
Definition: HttpRequest.h:221
void clean()
Definition: HttpHeader.cc:184
void httpRequestPack(void *obj, Packable *p)
Definition: HttpRequest.cc:371
int dnsWait
sum of DNS lookup delays in milliseconds, for dt
Definition: HttpRequest.h:147
void HttpRequestMethodXXX(char const *)
bool intercepted
Definition: RequestFlags.h:64
int64_t getRangeOffsetLimit()
Definition: HttpRequest.cc:601
AclSizeLimit * rangeOffsetLimit
Definition: SquidConfig.h:453
bool respMaybeCacheable() const
void detailError(err_type aType, int aDetail)
sets error detail if no earlier detail was available
Definition: HttpRequest.cc:456
bool conditional() const
has at least one recognized If-* header
Definition: HttpRequest.cc:579
String extacl_user
Definition: HttpRequest.h:167
void appendf(const char *fmt,...) PRINTF_FORMAT_ARG2
Append operation with printf-style arguments.
Definition: Packable.h:61
Adaptation::History::Pointer adaptHistory_
per-HTTP transaction info
Definition: HttpRequest.h:107
size_t HttpReply *STUB StoreEntry const KeyScope scope const HttpRequestMethod & method
Definition: stub_store.cc:126
virtual void packFirstLineInto(Packable *p, bool full_uri) const
Definition: HttpRequest.cc:478
bool chunked() const
whether message uses chunked Transfer-Encoding
Definition: HttpHeader.h:188
ProtocolType
Definition: ProtocolType.h:22
Comm::ConnectionPointer clientConnection
Definition: Server.h:97
Auth::UserRequest::Pointer auth_user_request
Definition: HttpRequest.h:115
void packInto(Packable *p, bool mask_sensitive_info=false) const
Definition: HttpHeader.cc:545
BodyPipe::Pointer body_pipe
optional pipeline to receive message body
Definition: Message.h:97
bool multipartRangeRequest() const
Definition: HttpRequest.cc:444
virtual void hdrCacheInit()
Definition: Message.cc:282
void clean()
Definition: String.cc:125
unsigned int minor
minor version number
SBuf StringToSBuf(const String &s)
create a new SBuf from a String by copying contents
Definition: StringConvert.h:17
struct ConnStateData::@40 pinning
bool hasNoStore() const
Definition: HttpHdrCc.h:102
virtual bool sanityCheckStartLine(const char *buf, const size_t hdr_len, Http::StatusCode *error)
Definition: HttpRequest.cc:270
#define SQUIDSBUFPH
Definition: SBuf.h:32
acl_access * spoof_client_ip
Definition: SquidConfig.h:395
const char * findFirst(const char *noteKey) const
Definition: Notes.cc:263
String myportname
Definition: HttpRequest.h:163
void init()
Definition: HttpRequest.cc:76
#define SQUIDSBUFPRINT(s)
Definition: SBuf.h:33
LogConfig TheConfig
Definition: Config.cc:15
char * peer_login
Definition: HttpRequest.h:152
SBuf & absolute() const
Definition: url.cc:488
Ip::Address indirect_client_addr
Definition: HttpRequest.h:140
bool spoofClientIp
Definition: RequestFlags.h:72
time_t lastmod
Definition: HttpRequest.h:156
void remove(const char *key)
Definition: Notes.cc:284
void clean()
Definition: HttpRequest.cc:122
class SquidConfig Config
Definition: SquidConfig.cc:12
virtual bool expectingBody(const HttpRequestMethod &unused, int64_t &) const
Definition: HttpRequest.cc:494
String etag
A strong etag of the cached entry. Used for refreshing that entry.
Definition: HttpRequest.h:180
#define NULL
Definition: types.h:166
uint32_t sources
The message sources.
Definition: Message.h:99
Cbc * get() const
a temporary valid raw Cbc pointer or NULL
Definition: CbcPointer.h:162
virtual void hdrCacheInit()
Definition: HttpRequest.cc:389
char * peer_domain
Definition: HttpRequest.h:161
err_type
Definition: err_type.h:12

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors