HttpRequest.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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 
34 #if USE_AUTH
35 #include "auth/UserRequest.h"
36 #endif
37 #if ICAP_CLIENT
39 #endif
40 
42  Http::Message(hoRequest),
43  masterXaction(mx)
44 {
45  assert(mx);
46  init();
47 }
48 
49 HttpRequest::HttpRequest(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aSchemeImg, const char *aUrlpath, const MasterXaction::Pointer &mx) :
50  Http::Message(hoRequest),
51  masterXaction(mx)
52 {
53  assert(mx);
54  static unsigned int id = 1;
55  debugs(93,7, HERE << "constructed, this=" << this << " id=" << ++id);
56  init();
57  initHTTP(aMethod, aProtocol, aSchemeImg, aUrlpath);
58 }
59 
61 {
62  clean();
63  debugs(93,7, HERE << "destructed, this=" << this);
64 }
65 
66 void
67 HttpRequest::initHTTP(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aSchemeImg, const char *aUrlpath)
68 {
69  method = aMethod;
70  url.setScheme(aProtocol, aSchemeImg);
71  url.path(aUrlpath);
72 }
73 
74 void
76 {
78  url.clear();
79 #if USE_AUTH
81 #endif
82  memset(&flags, '\0', sizeof(flags));
83  range = NULL;
84  ims = -1;
85  imslen = 0;
86  lastmod = -1;
88  my_addr.setEmpty();
89  body_pipe = NULL;
90  // hier
91  dnsWait = -1;
92  errType = ERR_NONE;
94  peer_login = NULL; // not allocated/deallocated by this class
95  peer_domain = NULL; // not allocated/deallocated by this class
96  peer_host = NULL;
97  vary_headers = SBuf();
99  tag = null_string;
100 #if USE_AUTH
103 #endif
107 #if FOLLOW_X_FORWARDED_FOR
109 #endif /* FOLLOW_X_FORWARDED_FOR */
110 #if USE_ADAPTATION
112 #endif
113 #if ICAP_CLIENT
114  icapHistory_ = NULL;
115 #endif
116  rangeOffsetLimit = -2; //a value of -2 means not checked yet
117  forcedBodyContinuation = false;
118 }
119 
120 void
122 {
123  // we used to assert that the pipe is NULL, but now the request only
124  // points to a pipe that is owned and initiated by another object.
125  body_pipe = NULL;
126 #if USE_AUTH
128 #endif
130  url.clear();
131 
132  header.clean();
133 
134  if (cache_control) {
135  delete cache_control;
137  }
138 
139  if (range) {
140  delete range;
141  range = NULL;
142  }
143 
144  myportname.clean();
145 
146  theNotes = nullptr;
147 
148  tag.clean();
149 #if USE_AUTH
150  extacl_user.clean();
152 #endif
153  extacl_log.clean();
154 
156 
157  etag.clean();
158 
159 #if USE_ADAPTATION
161 #endif
162 #if ICAP_CLIENT
163  icapHistory_ = NULL;
164 #endif
165 }
166 
167 void
169 {
170  clean();
171  init();
172 }
173 
174 HttpRequest *
176 {
178  copy->method = method;
179  // TODO: move common cloning clone to Msg::copyTo() or copy ctor
180  copy->header.append(&header);
181  copy->hdrCacheInit();
182  copy->hdr_sz = hdr_sz;
183  copy->http_ver = http_ver;
184  copy->pstate = pstate; // TODO: should we assert a specific state here?
185  copy->body_pipe = body_pipe;
186 
187  copy->url = url;
188 
189  // range handled in hdrCacheInit()
190  copy->ims = ims;
191  copy->imslen = imslen;
192  copy->hier = hier; // Is it safe to copy? Should we?
193 
194  copy->errType = errType;
195 
196  // XXX: what to do with copy->peer_login?
197 
198  copy->lastmod = lastmod;
199  copy->etag = etag;
200  copy->vary_headers = vary_headers;
201  // XXX: what to do with copy->peer_domain?
202 
203  copy->tag = tag;
204  copy->extacl_log = extacl_log;
206 
207  const bool inheritWorked = copy->inheritProperties(this);
208  assert(inheritWorked);
209 
210  return copy;
211 }
212 
213 bool
215 {
216  const HttpRequest* aReq = dynamic_cast<const HttpRequest*>(aMsg);
217  if (!aReq)
218  return false;
219 
220  client_addr = aReq->client_addr;
221 #if FOLLOW_X_FORWARDED_FOR
223 #endif
224  my_addr = aReq->my_addr;
225 
226  dnsWait = aReq->dnsWait;
227 
228 #if USE_ADAPTATION
229  adaptHistory_ = aReq->adaptHistory();
230 #endif
231 #if ICAP_CLIENT
232  icapHistory_ = aReq->icapHistory();
233 #endif
234 
235  // This may be too conservative for the 204 No Content case
236  // may eventually need cloneNullAdaptationImmune() for that.
238 
239  errType = aReq->errType;
240  errDetail = aReq->errDetail;
241 #if USE_AUTH
243  extacl_user = aReq->extacl_user;
245 #endif
246 
247  myportname = aReq->myportname;
248 
250 
251  // main property is which connection the request was received on (if any)
253 
254  downloader = aReq->downloader;
255 
256  theNotes = aReq->theNotes;
257 
258  sources = aReq->sources;
259  return true;
260 }
261 
268 bool
269 HttpRequest::sanityCheckStartLine(const char *buf, const size_t hdr_len, Http::StatusCode *error)
270 {
271  // content is long enough to possibly hold a reply
272  // 2 being magic size of a 1-byte request method plus space delimiter
273  if (hdr_len < 2) {
274  // this is ony a real error if the headers apparently complete.
275  if (hdr_len > 0) {
276  debugs(58, 3, HERE << "Too large request header (" << hdr_len << " bytes)");
277  *error = Http::scInvalidHeader;
278  }
279  return false;
280  }
281 
282  /* See if the request buffer starts with a non-whitespace HTTP request 'method'. */
284  m.HttpRequestMethodXXX(buf);
285  if (m == Http::METHOD_NONE) {
286  debugs(73, 3, "HttpRequest::sanityCheckStartLine: did not find HTTP request method");
287  *error = Http::scInvalidHeader;
288  return false;
289  }
290 
291  return true;
292 }
293 
294 bool
295 HttpRequest::parseFirstLine(const char *start, const char *end)
296 {
298 
299  if (method == Http::METHOD_NONE)
300  return false;
301 
302  // XXX: performance regression, strcspn() over the method bytes a second time.
303  // cheaper than allocate+copy+deallocate cycle to SBuf convert a piece of start.
304  const char *t = start + strcspn(start, w_space);
305 
306  start = t + strspn(t, w_space); // skip w_space after method
307 
308  const char *ver = findTrailingHTTPVersion(start, end);
309 
310  if (ver) {
311  end = ver - 1;
312 
313  while (xisspace(*end)) // find prev non-space
314  --end;
315 
316  ++end; // back to space
317 
318  if (2 != sscanf(ver + 5, "%d.%d", &http_ver.major, &http_ver.minor)) {
319  debugs(73, DBG_IMPORTANT, "parseRequestLine: Invalid HTTP identifier.");
320  return false;
321  }
322  } else {
323  http_ver.major = 0;
324  http_ver.minor = 9;
325  }
326 
327  if (end < start) // missing URI
328  return false;
329 
330  char save = *end;
331 
332  * (char *) end = '\0'; // temp terminate URI, XXX dangerous?
333 
334  const bool ret = url.parse(method, start);
335 
336  * (char *) end = save;
337 
338  return ret;
339 }
340 
341 /* swaps out request using httpRequestPack */
342 void
344 {
345  assert(e);
346  e->buffer();
347  pack(e);
348  e->flush();
349 }
350 
351 /* packs request-line and headers, appends <crlf> terminator */
352 void
354 {
355  assert(p);
356  /* pack request-line */
357  p->appendf(SQUIDSBUFPH " " SQUIDSBUFPH " HTTP/%d.%d\r\n",
360  /* headers */
361  header.packInto(p);
362  /* trailer */
363  p->append("\r\n", 2);
364 }
365 
366 /*
367  * A wrapper for debugObj()
368  */
369 void
371 {
372  HttpRequest *request = static_cast<HttpRequest*>(obj);
373  request->pack(p);
374 }
375 
376 /* returns the length of request line + headers + crlf */
377 int
379 {
380  return method.image().length() + 1 +
381  url.path().length() + 1 +
382  4 + 1 + 3 + 2 +
383  header.len + 2;
384 }
385 
386 /* sync this routine when you update HttpRequest struct */
387 void
389 {
391 
392  assert(!range);
393  range = header.getRange();
394 }
395 
396 #if ICAP_CLIENT
399 {
400  if (!icapHistory_) {
401  if (Log::TheConfig.hasIcapToken || IcapLogfileStatus == LOG_ENABLE) {
403  debugs(93,4, HERE << "made " << icapHistory_ << " for " << this);
404  }
405  }
406 
407  return icapHistory_;
408 }
409 #endif
410 
411 #if USE_ADAPTATION
413 HttpRequest::adaptHistory(bool createIfNone) const
414 {
415  if (!adaptHistory_ && createIfNone) {
417  debugs(93,4, HERE << "made " << adaptHistory_ << " for " << this);
418  }
419 
420  return adaptHistory_;
421 }
422 
425 {
426  return HttpRequest::adaptHistory(Log::TheConfig.hasAdaptToken);
427 }
428 
429 void
431 {
432  if (!adaptHistory_) {
433  adaptHistory_ = them.adaptHistory_; // may be nil
434  } else {
435  // check that histories did not diverge
436  Must(!them.adaptHistory_ || them.adaptHistory_ == adaptHistory_);
437  }
438 }
439 
440 #endif
441 
442 bool
444 {
445  return (range && range->specs.size() > 1);
446 }
447 
448 bool
450 {
451  return body_pipe != NULL && body_pipe->consumedSize() > 0;
452 }
453 
454 void
456 {
457  if (errType || errDetail)
458  debugs(11, 5, HERE << "old error details: " << errType << '/' << errDetail);
459  debugs(11, 5, HERE << "current error details: " << aType << '/' << aDetail);
460  // checking type and detail separately may cause inconsistency, but
461  // may result in more details available if they only become available later
462  if (!errType)
463  errType = aType;
464  if (!errDetail)
465  errDetail = aDetail;
466 }
467 
468 void
470 {
471  debugs(11, 7, HERE << "old error details: " << errType << '/' << errDetail);
472  errType = ERR_NONE;
474 }
475 
476 void
478 {
479  const SBuf tmp(full_uri ? effectiveRequestUri() : url.path());
480 
481  // form HTTP request-line
482  p->appendf(SQUIDSBUFPH " " SQUIDSBUFPH " HTTP/%d.%d\r\n",
484  SQUIDSBUFPRINT(tmp),
486 }
487 
488 /*
489  * Indicate whether or not we would expect an entity-body
490  * along with this request
491  */
492 bool
493 HttpRequest::expectingBody(const HttpRequestMethod &, int64_t &theSize) const
494 {
495  bool expectBody = false;
496 
497  /*
498  * Note: Checks for message validity is in clientIsContentLengthValid().
499  * this just checks if a entity-body is expected based on HTTP message syntax
500  */
501  if (header.chunked()) {
502  expectBody = true;
503  theSize = -1;
504  } else if (content_length >= 0) {
505  expectBody = true;
506  theSize = content_length;
507  } else {
508  expectBody = false;
509  // theSize undefined
510  }
511 
512  return expectBody;
513 }
514 
515 /*
516  * Create a Request from a URL and METHOD.
517  *
518  * If the METHOD is CONNECT, then a host:port pair is looked for instead of a URL.
519  * If the request cannot be created cleanly, NULL is returned
520  */
521 HttpRequest *
523 {
524  std::unique_ptr<HttpRequest> req(new HttpRequest(mx));
525  if (req->url.parse(method, url)) {
526  req->method = method;
527  return req.release();
528  }
529  return nullptr;
530 }
531 
536 bool
538 {
539  // Intercepted request with Host: header which cannot be trusted.
540  // Because it failed verification, or someone bypassed the security tests
541  // we cannot cache the reponse for sharing between clients.
542  // TODO: update cache to store for particular clients only (going to same Host: and destination IP)
544  return false;
545 
546  switch (url.getScheme()) {
547  case AnyP::PROTO_HTTP:
548  case AnyP::PROTO_HTTPS:
549  if (!method.respMaybeCacheable())
550  return false;
551 
552  // RFC 7234 section 5.2.1.5:
553  // "cache MUST NOT store any part of either this request or any response to it"
554  //
555  // NP: refresh_pattern ignore-no-store only applies to response messages
556  // this test is handling request message CC header.
558  return false;
559  break;
560 
561  case AnyP::PROTO_GOPHER:
562  if (!gopherCachable(this))
563  return false;
564  break;
565 
567  return false;
568 
569  //case AnyP::PROTO_FTP:
570  default:
571  break;
572  }
573 
574  return true;
575 }
576 
577 bool
579 {
580  return flags.ims ||
583 }
584 
585 void
587 {
588  if (dns.wait >= 0) { // known delay
589  if (dnsWait >= 0) { // have recorded DNS wait before
590  debugs(78, 7, this << " " << dnsWait << " += " << dns);
591  dnsWait += dns.wait;
592  } else {
593  debugs(78, 7, this << " " << dns);
594  dnsWait = dns.wait;
595  }
596  }
597 }
598 
599 int64_t
601 {
602  /* -2 is the starting value of rangeOffsetLimit.
603  * If it is -2, that means we haven't checked it yet.
604  * Otherwise, return the current value */
605  if (rangeOffsetLimit != -2)
606  return rangeOffsetLimit;
607 
608  rangeOffsetLimit = 0; // default value for rangeOffsetLimit
609 
610  ACLFilledChecklist ch(NULL, this, NULL);
611  ch.src_addr = client_addr;
612  ch.my_addr = my_addr;
613 
614  for (AclSizeLimit *l = Config.rangeOffsetLimit; l; l = l -> next) {
615  /* if there is no ACL list or if the ACLs listed match use this limit value */
616  if (!l->aclList || ch.fastCheck(l->aclList).allowed()) {
617  debugs(58, 4, HERE << "rangeOffsetLimit=" << rangeOffsetLimit);
618  rangeOffsetLimit = l->size; // may be -1
619  break;
620  }
621  }
622 
623  return rangeOffsetLimit;
624 }
625 
626 void
627 HttpRequest::ignoreRange(const char *reason)
628 {
629  if (range) {
630  debugs(73, 3, static_cast<void*>(range) << " for " << reason);
631  delete range;
632  range = NULL;
633  }
634  // Some callers also reset isRanged but it may not be safe for all callers:
635  // isRanged is used to determine whether a weak ETag comparison is allowed,
636  // and that check should not ignore the Range header if it was present.
637  // TODO: Some callers also delete HDR_RANGE, HDR_REQUEST_RANGE. Should we?
638 }
639 
640 bool
642 {
643  // old clients do not support 1xx unless they sent Expect: 100-continue
644  // (we reject all other Http::HdrType::EXPECT values so just check for Http::HdrType::EXPECT)
646  return false;
647 
648  // others must support 1xx control messages
649  return true;
650 }
651 
654 {
656  return clientConnectionManager.get();
657  return NULL;
658 }
659 
660 const SBuf
662 {
663  if (store_id.size() != 0) {
664  debugs(73, 3, "sent back store_id: " << store_id);
665  return StringToSBuf(store_id);
666  }
667  debugs(73, 3, "sent back effectiveRequestUrl: " << effectiveRequestUri());
668  return effectiveRequestUri();
669 }
670 
671 const SBuf &
673 {
675  return url.authority(true); // host:port
676  return url.absolute();
677 }
678 
681 {
682  if (!theNotes)
683  theNotes = new NotePairs;
684  return theNotes;
685 }
686 
687 void
689 {
690  // Tag client connection if the helper responded with clt_conn_tag=tag.
691  const char *cltTag = "clt_conn_tag";
692  if (const char *connTag = helperNotes.findFirst(cltTag)) {
693  if (csd) {
694  csd->notes()->remove(cltTag);
695  csd->notes()->add(cltTag, connTag);
696  }
697  }
698  request.notes()->replaceOrAdd(&helperNotes);
699 }
700 
701 void
703 {
705 
707  return;
708 
710  if (port) {
711  myportname = port->name;
712  flags.ignoreCc = port->ignore_cc;
713  }
714 
715  if (auto clientConnection = clientConnectionManager->clientConnection) {
716  client_addr = clientConnection->remote; // XXX: remove request->client_addr member.
717 #if FOLLOW_X_FORWARDED_FOR
718  // indirect client gets stored here because it is an HTTP header result (from X-Forwarded-For:)
719  // not details about the TCP connection itself
720  indirect_client_addr = clientConnection->remote;
721 #endif /* FOLLOW_X_FORWARDED_FOR */
722  my_addr = clientConnection->local;
723 
724  flags.intercepted = ((clientConnection->flags & COMM_INTERCEPTION) != 0);
725  flags.interceptTproxy = ((clientConnection->flags & COMM_TRANSPARENT) != 0 ) ;
726  const bool proxyProtocolPort = port ? port->flags.proxySurrogate : false;
727  if (flags.interceptTproxy && !proxyProtocolPort) {
729  ACLFilledChecklist *checklist = new ACLFilledChecklist(Config.accessList.spoof_client_ip, this, clientConnection->rfc931);
730  checklist->al = al;
731  checklist->syncAle(this, nullptr);
732  flags.spoofClientIp = checklist->fastCheck().allowed();
733  delete checklist;
734  } else
735  flags.spoofClientIp = true;
736  } else
737  flags.spoofClientIp = false;
738  }
739 }
740 
742 static const Ip::Address *
744 {
745  // FindListeningPortAddress() callers do not want INADDR_ANY addresses
746  return (ip && !ip->isAnyAddr()) ? ip : nullptr;
747 }
748 
750 static const Ip::Address *
752 {
753  return port ? FindListeningPortAddressInAddress(&port->s) : nullptr;
754 }
755 
757 static const Ip::Address *
759 {
760  return conn ? FindListeningPortAddressInAddress(&conn->local) : nullptr;
761 }
762 
763 const Ip::Address *
764 FindListeningPortAddress(const HttpRequest *callerRequest, const AccessLogEntry *ale)
765 {
766  // Check all sources of usable listening port information, giving
767  // HttpRequest and masterXaction a preference over ALE.
768 
769  const HttpRequest *request = callerRequest;
770  if (!request && ale)
771  request = ale->request;
772  if (!request)
773  return nullptr; // not enough information
774 
776  if (!ip && ale)
778 
779  // XXX: also handle PROXY protocol here when we have a flag to identify such request
780  if (ip || request->flags.interceptTproxy || request->flags.intercepted)
781  return ip;
782 
783  /* handle non-intercepted cases that were not handled above */
785  if (!ip && ale)
787  return ip; // may still be nil
788 }
789 
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:586
static const Ip::Address * FindListeningPortAddressInAddress(const Ip::Address *ip)
a helper for validating FindListeningPortAddress()-found address candidates
Definition: HttpRequest.cc:743
HierarchyLogEntry hier
Definition: HttpRequest.h:145
static const Ip::Address * FindListeningPortAddressInConn(const Comm::ConnectionPointer &conn)
a helper for handling Connection cases of FindListeningPortAddress()
Definition: HttpRequest.cc:758
AnyP::ProtocolVersion ProtocolVersion(unsigned int aMajor, unsigned int aMinor)
HTTP version label information.
AnyP::PortCfgPointer squidPort
the listening port which originated this transaction
Definition: MasterXaction.h:50
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:353
err_type errType
Definition: HttpRequest.h:149
ConnStateData * pinnedConnection()
Definition: HttpRequest.cc:653
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:41
void UpdateRequestNotes(ConnStateData *csd, HttpRequest &request, NotePairs const &helperNotes)
Definition: HttpRequest.cc:688
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:67
void path(const char *p)
Definition: Uri.h:83
Definition: SBuf.h:86
const char * null_string
bool canHandle1xx() const
whether the client is likely to be able to handle a 1xx reply
Definition: HttpRequest.cc:641
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:280
void error(char *format,...)
int IcapLogfileStatus
Definition: icap_log.cc:20
RequestFlags cloneAdaptationImmune() const
Definition: RequestFlags.cc:18
virtual void buffer()
Definition: store.cc:1653
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:1664
void clear()
Definition: SBuf.cc:178
#define Must(condition)
Like assert() but throws an exception instead of aborting the process.
Definition: TextException.h:69
#define COMM_INTERCEPTION
Definition: Connection.h:49
Comm::ConnectionPointer tcpClient
TCP/IP level details about the client connection.
AnyP::ProtocolVersion http_ver
Definition: Message.h:72
#define xisspace(x)
Definition: xis.h:17
void replaceOrAdd(const NotePairs *src)
Definition: Notes.cc:358
HttpHdrRange * getRange() const
Definition: HttpHeader.cc:1263
char * p
Definition: membanger.c:43
int conn
the current server connection FD
Definition: Transport.cc:26
time_t ims
Definition: HttpRequest.h:133
bool hostVerified
Definition: RequestFlags.h:66
size_type size() const
Definition: SquidString.h:72
const SBuf storeId()
Definition: HttpRequest.cc:661
const char * findTrailingHTTPVersion(const char *uriAndHTTPVersion, const char *end)
static const Ip::Address * FindListeningPortAddressInPort(const AnyP::PortCfgPointer &port)
a helper for handling PortCfg cases of FindListeningPortAddress()
Definition: HttpRequest.cc:751
bool isAnyAddr() const
Definition: Address.cc:163
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:702
String extacl_message
Definition: HttpRequest.h:173
int gopherCachable(const HttpRequest *req)
Definition: gopher.cc:294
NotePairs::Pointer notes()
Definition: HttpRequest.cc:680
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:404
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:430
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
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:124
Adaptation::History::Pointer adaptHistory(bool createIfNone=false) const
Returns possibly nil history, creating it if requested.
Definition: HttpRequest.cc:413
bool bodyNibbled() const
Definition: HttpRequest.cc:449
#define DBG_IMPORTANT
Definition: Debug.h:46
void swapOut(StoreEntry *e)
Definition: HttpRequest.cc:343
NotePairs::Pointer notes()
bool parse(const HttpRequestMethod &, const char *url)
Definition: Uri.cc:191
void setScheme(const AnyP::ProtocolType &p, const char *str)
convert the URL scheme to that given
Definition: Uri.h:67
virtual HttpRequest * clone() const
Definition: HttpRequest.cc:175
Ip::Address client_addr
Definition: HttpRequest.h:137
virtual bool inheritProperties(const Http::Message *)
Definition: HttpRequest.cc:214
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:672
common parts of HttpRequest and HttpReply
Definition: Message.h:24
NotePairs::Pointer theNotes
Definition: HttpRequest.h:240
AnyP::Uri url
the request URI
Definition: HttpRequest.h:103
CbcPointer< ConnStateData > clientConnectionManager
Definition: HttpRequest.h:218
HttpRequest * request
bool allowed() const
Definition: Acl.h:141
AnyP::UriScheme const & getScheme() const
Definition: Uri.h:64
int prefixLen() const
Definition: HttpRequest.cc:378
std::vector< HttpHdrRangeSpec * > specs
void setEmpty()
Fast reset of the stored content to what would be after default constructor.
Definition: Address.cc:177
SBuf & absolute() const
Definition: Uri.cc:488
static int port
Definition: ldap_backend.cc:69
void clearError()
clear error details, useful for retries/repeats
Definition: HttpRequest.cc:469
static HttpRequest * FromUrl(const char *url, const MasterXaction::Pointer &, const HttpRequestMethod &method=Http::METHOD_GET)
Definition: HttpRequest.cc:522
void ignoreRange(const char *reason)
forgets about the cached Range header (for a reason)
Definition: HttpRequest.cc:627
virtual void reset()
Definition: HttpRequest.cc:168
void const char * buf
Definition: stub_helper.cc:16
std::ostream & HERE(std::ostream &s)
Definition: Debug.h:153
class AccessLogEntry::CacheDetails cache
collects information about ICAP processing related to an HTTP transaction
Definition: History.h:23
Ip::Address local
Definition: Connection.h:135
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:424
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:398
const SBuf & image() const
bool maybeCacheable()
Definition: HttpRequest.cc:537
bool parseFirstLine(const char *start, const char *end)
Definition: HttpRequest.cc:295
#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:370
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:600
AclSizeLimit * rangeOffsetLimit
Definition: SquidConfig.h:454
const Ip::Address * FindListeningPortAddress(const HttpRequest *callerRequest, const AccessLogEntry *ale)
Definition: HttpRequest.cc:764
bool respMaybeCacheable() const
AnyP::PortCfgPointer port
void detailError(err_type aType, int aDetail)
sets error detail if no earlier detail was available
Definition: HttpRequest.cc:455
bool conditional() const
has at least one recognized If-* header
Definition: HttpRequest.cc:578
struct SquidConfig::@114 accessList
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:477
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:443
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
void clear()
Definition: Uri.h:52
virtual bool sanityCheckStartLine(const char *buf, const size_t hdr_len, Http::StatusCode *error)
Definition: HttpRequest.cc:269
#define SQUIDSBUFPH
Definition: SBuf.h:31
SBuf & authority(bool requirePort=false) const
Definition: Uri.cc:470
acl_access * spoof_client_ip
Definition: SquidConfig.h:395
const char * findFirst(const char *noteKey) const
Definition: Notes.cc:265
String myportname
Definition: HttpRequest.h:163
void init()
Definition: HttpRequest.cc:75
#define SQUIDSBUFPRINT(s)
Definition: SBuf.h:32
LogConfig TheConfig
Definition: Config.cc:15
char * peer_login
Definition: HttpRequest.h:152
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:286
void clean()
Definition: HttpRequest.cc:121
Comm::ConnectionPointer tcpClient
the client TCP connection which originated this transaction
Definition: MasterXaction.h:53
class SquidConfig Config
Definition: SquidConfig.cc:12
virtual bool expectingBody(const HttpRequestMethod &unused, int64_t &) const
Definition: HttpRequest.cc:493
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:388
char * peer_domain
Definition: HttpRequest.h:161
virtual void syncAle(HttpRequest *adaptedRequest, const char *logUri) const
assigns uninitialized adapted_request and url ALE components
err_type
Definition: err_type.h:12

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors