]> git.ipfire.org Git - thirdparty/squid.git/blame - src/HttpRequest.cc
Fix external ACL user:pass detail logging after adaptation
[thirdparty/squid.git] / src / HttpRequest.cc
CommitLineData
99edd1c3 1/*
99edd1c3 2 * DEBUG: section 73 HTTP Request
3 * AUTHOR: Duane Wessels
4 *
2b6662ba 5 * SQUID Web Proxy Cache http://www.squid-cache.org/
e25c139f 6 * ----------------------------------------------------------
99edd1c3 7 *
2b6662ba 8 * Squid is the result of efforts by numerous individuals from
9 * the Internet community; see the CONTRIBUTORS file for full
10 * details. Many organizations have provided support for Squid's
11 * development; see the SPONSORS file for full details. Squid is
12 * Copyrighted (C) 2001 by the Regents of the University of
13 * California; see the COPYRIGHT file for full details. Squid
14 * incorporates software developed and/or copyrighted by other
15 * sources; see the CREDITS file for full details.
99edd1c3 16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
9e008dda 21 *
99edd1c3 22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
9e008dda 26 *
99edd1c3 27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
cbdec147 29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
e25c139f 30 *
51ee7c82 31 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
99edd1c3 32 */
33
582c2af2 34#include "squid.h"
f4698e0b 35#include "AccessLogEntry.h"
1328cfb7 36#include "acl/AclSizeLimit.h"
582c2af2
FC
37#include "acl/FilledChecklist.h"
38#include "client_side.h"
cfd66529 39#include "DnsLookupDetails.h"
582c2af2 40#include "err_detail_type.h"
67679543 41#include "globals.h"
d05c079c 42#include "gopher.h"
5c0c642e 43#include "http.h"
7ebe76de 44#include "HttpHdrCc.h"
528b2c61 45#include "HttpHeaderRange.h"
582c2af2 46#include "HttpRequest.h"
38e16f92 47#include "log/Config.h"
0eb49b6d 48#include "MemBuf.h"
4d5904f7 49#include "SquidConfig.h"
25b6a907 50#include "Store.h"
b1bd952a 51#include "URL.h"
582c2af2
FC
52
53#if USE_AUTH
54#include "auth/UserRequest.h"
55#endif
3ff65596
AR
56#if ICAP_CLIENT
57#include "adaptation/icap/icap_log.h"
58#endif
528b2c61 59
3aaa8e6f 60HttpRequest::HttpRequest() :
f4f55a21 61 HttpMsg(hoRequest)
75faaa7a 62{
5cafad19 63 init();
64}
65
d06e17ea 66HttpRequest::HttpRequest(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aUrlpath) :
f4f55a21 67 HttpMsg(hoRequest)
5cafad19 68{
5dfc3258
AR
69 static unsigned int id = 1;
70 debugs(93,7, HERE << "constructed, this=" << this << " id=" << ++id);
5cafad19 71 init();
0e8aad88 72 initHTTP(aMethod, aProtocol, aUrlpath);
5cafad19 73}
74
75HttpRequest::~HttpRequest()
76{
5cafad19 77 clean();
5dfc3258 78 debugs(93,7, HERE << "destructed, this=" << this);
5cafad19 79}
80
81void
0c3d3f65 82HttpRequest::initHTTP(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aUrlpath)
5cafad19 83{
84 method = aMethod;
85 protocol = aProtocol;
86 urlpath = aUrlpath;
87}
88
89void
90HttpRequest::init()
91{
c2a7cefd 92 method = Http::METHOD_NONE;
0c3d3f65 93 protocol = AnyP::PROTO_NONE;
30abd221 94 urlpath = NULL;
a3f28359 95 login[0] = '\0';
96 host[0] = '\0';
12ef783b 97 host_is_numeric = -1;
2f1431ea 98#if USE_AUTH
a3f28359 99 auth_user_request = NULL;
2f1431ea 100#endif
a3f28359 101 port = 0;
102 canonical = NULL;
a3f28359 103 memset(&flags, '\0', sizeof(flags));
104 range = NULL;
105 ims = -1;
106 imslen = 0;
5cafad19 107 lastmod = -1;
4dd643d5
AJ
108 client_addr.setEmpty();
109 my_addr.setEmpty();
5f8252d2 110 body_pipe = NULL;
a3f28359 111 // hier
3ff65596 112 dnsWait = -1;
a3f28359 113 errType = ERR_NONE;
64b66b76 114 errDetail = ERR_DETAIL_NONE;
5cafad19 115 peer_login = NULL; // not allocated/deallocated by this class
116 peer_domain = NULL; // not allocated/deallocated by this class
593d3cdb 117 peer_host = NULL;
a3f28359 118 vary_headers = NULL;
35fb56c9 119 myportname = null_string;
5cafad19 120 tag = null_string;
2f1431ea 121#if USE_AUTH
5cafad19 122 extacl_user = null_string;
123 extacl_passwd = null_string;
2f1431ea 124#endif
5cafad19 125 extacl_log = null_string;
8c93a598 126 extacl_message = null_string;
c99de607 127 pstate = psReadyToParseStartLine;
3d674977 128#if FOLLOW_X_FORWARDED_FOR
4dd643d5 129 indirect_client_addr.setEmpty();
3d674977 130#endif /* FOLLOW_X_FORWARDED_FOR */
3ff65596
AR
131#if USE_ADAPTATION
132 adaptHistory_ = NULL;
133#endif
134#if ICAP_CLIENT
135 icapHistory_ = NULL;
136#endif
11e3fa1c 137 rangeOffsetLimit = -2; //a value of -2 means not checked yet
8596962e 138}
139
99edd1c3 140void
5cafad19 141HttpRequest::clean()
99edd1c3 142{
9e008dda 143 // we used to assert that the pipe is NULL, but now the request only
5f8252d2 144 // points to a pipe that is owned and initiated by another object.
9e008dda 145 body_pipe = NULL;
2f1431ea 146#if USE_AUTH
a33a428a 147 auth_user_request = NULL;
2f1431ea 148#endif
8596962e 149 safe_free(canonical);
62e76326 150
8596962e 151 safe_free(vary_headers);
62e76326 152
30abd221 153 urlpath.clean();
62e76326 154
519e0948 155 header.clean();
62e76326 156
07947ad8 157 if (cache_control) {
3d7782c1 158 delete cache_control;
07947ad8 159 cache_control = NULL;
160 }
62e76326 161
5cafad19 162 if (range) {
8596962e 163 delete range;
5cafad19 164 range = NULL;
165 }
62e76326 166
35fb56c9
AJ
167 myportname.clean();
168
f4f55a21 169 notes = NULL;
d06e17ea 170
30abd221 171 tag.clean();
2f1431ea 172#if USE_AUTH
30abd221 173 extacl_user.clean();
30abd221 174 extacl_passwd.clean();
2f1431ea 175#endif
30abd221 176 extacl_log.clean();
3ff65596 177
8c93a598
HN
178 extacl_message.clean();
179
3ff65596
AR
180#if USE_ADAPTATION
181 adaptHistory_ = NULL;
182#endif
183#if ICAP_CLIENT
184 icapHistory_ = NULL;
185#endif
8596962e 186}
4a972fa2 187
5cafad19 188void
189HttpRequest::reset()
190{
191 clean();
192 init();
193}
194
fa0e6114
AR
195HttpRequest *
196HttpRequest::clone() const
197{
b4f2886c 198 HttpRequest *copy = new HttpRequest(method, protocol, urlpath.termedBuf());
fa0e6114
AR
199 // TODO: move common cloning clone to Msg::copyTo() or copy ctor
200 copy->header.append(&header);
201 copy->hdrCacheInit();
202 copy->hdr_sz = hdr_sz;
203 copy->http_ver = http_ver;
204 copy->pstate = pstate; // TODO: should we assert a specific state here?
205 copy->body_pipe = body_pipe;
206
207 strncpy(copy->login, login, sizeof(login)); // MAX_LOGIN_SZ
208 strncpy(copy->host, host, sizeof(host)); // SQUIDHOSTNAMELEN
209 copy->host_addr = host_addr;
210
fa0e6114
AR
211 copy->port = port;
212 // urlPath handled in ctor
9e008dda
AJ
213 copy->canonical = canonical ? xstrdup(canonical) : NULL;
214
66363092 215 // range handled in hdrCacheInit()
9e008dda
AJ
216 copy->ims = ims;
217 copy->imslen = imslen;
fa0e6114
AR
218 copy->hier = hier; // Is it safe to copy? Should we?
219
220 copy->errType = errType;
221
222 // XXX: what to do with copy->peer_login?
223
9e008dda 224 copy->lastmod = lastmod;
fa0e6114
AR
225 copy->vary_headers = vary_headers ? xstrdup(vary_headers) : NULL;
226 // XXX: what to do with copy->peer_domain?
227
35fb56c9 228 copy->myportname = myportname;
fa0e6114 229 copy->tag = tag;
fa0e6114 230 copy->extacl_log = extacl_log;
8c93a598 231 copy->extacl_message = extacl_message;
fa0e6114 232
fbc1c5a6
AJ
233 const bool inheritWorked = copy->inheritProperties(this);
234 assert(inheritWorked);
3ff65596 235
fa0e6114
AR
236 return copy;
237}
238
d5964067
AJ
239bool
240HttpRequest::inheritProperties(const HttpMsg *aMsg)
241{
242 const HttpRequest* aReq = dynamic_cast<const HttpRequest*>(aMsg);
243 if (!aReq)
244 return false;
245
246 client_addr = aReq->client_addr;
247#if FOLLOW_X_FORWARDED_FOR
248 indirect_client_addr = aReq->indirect_client_addr;
d5964067
AJ
249#endif
250 my_addr = aReq->my_addr;
251
252 dnsWait = aReq->dnsWait;
253
254#if USE_ADAPTATION
255 adaptHistory_ = aReq->adaptHistory();
256#endif
257#if ICAP_CLIENT
258 icapHistory_ = aReq->icapHistory();
259#endif
260
261 // This may be too conservative for the 204 No Content case
262 // may eventually need cloneNullAdaptationImmune() for that.
263 flags = aReq->flags.cloneAdaptationImmune();
264
265 errType = aReq->errType;
266 errDetail = aReq->errDetail;
267#if USE_AUTH
268 auth_user_request = aReq->auth_user_request;
d27929a8
NH
269 copy->extacl_user = extacl_user;
270 copy->extacl_passwd = extacl_passwd;
d5964067 271#endif
983983ce
AJ
272
273 // main property is which connection the request was received on (if any)
d5964067 274 clientConnectionManager = aReq->clientConnectionManager;
f4698e0b 275
f4f55a21 276 notes = aReq->notes;
d5964067
AJ
277 return true;
278}
279
96ee497f
AJ
280/**
281 * Checks the first line of an HTTP request is valid
282 * currently just checks the request method is present.
283 *
284 * NP: Other errors are left for detection later in the parse.
285 */
c21ad0f5 286bool
955394ce 287HttpRequest::sanityCheckStartLine(MemBuf *buf, const size_t hdr_len, Http::StatusCode *error)
8596962e 288{
96ee497f
AJ
289 // content is long enough to possibly hold a reply
290 // 2 being magic size of a 1-byte request method plus space delimiter
291 if ( buf->contentSize() < 2 ) {
292 // this is ony a real error if the headers apparently complete.
293 if (hdr_len > 0) {
0246f6b8 294 debugs(58, 3, HERE << "Too large request header (" << hdr_len << " bytes)");
955394ce 295 *error = Http::scInvalidHeader;
96ee497f
AJ
296 }
297 return false;
298 }
8596962e 299
96ee497f 300 /* See if the request buffer starts with a known HTTP request method. */
c2a7cefd 301 if (HttpRequestMethod(buf->content(),NULL) == Http::METHOD_NONE) {
bf8fe701 302 debugs(73, 3, "HttpRequest::sanityCheckStartLine: did not find HTTP request method");
955394ce 303 *error = Http::scInvalidHeader;
8596962e 304 return false;
305 }
306
307 return true;
308}
309
c21ad0f5 310bool
311HttpRequest::parseFirstLine(const char *start, const char *end)
8596962e 312{
863d85ee 313 const char *t = start + strcspn(start, w_space);
985c86bc 314 method = HttpRequestMethod(start, t);
863d85ee 315
c2a7cefd 316 if (method == Http::METHOD_NONE)
863d85ee 317 return false;
318
319 start = t + strspn(t, w_space);
320
321 const char *ver = findTrailingHTTPVersion(start, end);
322
323 if (ver) {
324 end = ver - 1;
325
326 while (xisspace(*end)) // find prev non-space
5e263176 327 --end;
863d85ee 328
95dc7ff4 329 ++end; // back to space
863d85ee 330
331 if (2 != sscanf(ver + 5, "%d.%d", &http_ver.major, &http_ver.minor)) {
e0236918 332 debugs(73, DBG_IMPORTANT, "parseRequestLine: Invalid HTTP identifier.");
863d85ee 333 return false;
334 }
335 } else {
336 http_ver.major = 0;
337 http_ver.minor = 9;
338 }
339
340 if (end < start) // missing URI
341 return false;
342
343 char save = *end;
344
345 * (char *) end = '\0'; // temp terminate URI, XXX dangerous?
346
347 HttpRequest *tmp = urlParse(method, (char *) start, this);
348
349 * (char *) end = save;
350
351 if (NULL == tmp)
352 return false;
353
354 return true;
99edd1c3 355}
356
99edd1c3 357int
666f514b 358HttpRequest::parseHeader(const char *parse_start, int len)
99edd1c3 359{
360 const char *blk_start, *blk_end;
62e76326 361
666f514b 362 if (!httpMsgIsolateHeaders(&parse_start, len, &blk_start, &blk_end))
62e76326 363 return 0;
364
a9925b40 365 int result = header.parse(blk_start, blk_end);
62e76326 366
528b2c61 367 if (result)
07947ad8 368 hdrCacheInit();
62e76326 369
528b2c61 370 return result;
99edd1c3 371}
372
a00a7c85 373/* swaps out request using httpRequestPack */
99edd1c3 374void
5cafad19 375HttpRequest::swapOut(StoreEntry * e)
99edd1c3 376{
a00a7c85 377 Packer p;
5cafad19 378 assert(e);
a00a7c85 379 packerToStoreInit(&p, e);
5cafad19 380 pack(&p);
a00a7c85 381 packerClean(&p);
382}
383
384/* packs request-line and headers, appends <crlf> terminator */
385void
5cafad19 386HttpRequest::pack(Packer * p)
a00a7c85 387{
5cafad19 388 assert(p);
a00a7c85 389 /* pack request-line */
3872be7c
AJ
390 packerPrintf(p, "%s " SQUIDSTRINGPH " HTTP/%d.%d\r\n",
391 RequestMethodStr(method), SQUIDSTRINGPRINT(urlpath),
392 http_ver.major, http_ver.minor);
a00a7c85 393 /* headers */
a9925b40 394 header.packInto(p);
2246b732 395 /* trailer */
a00a7c85 396 packerAppend(p, "\r\n", 2);
2246b732 397}
398
5cafad19 399/*
400 * A wrapper for debugObj()
401 */
2246b732 402void
5cafad19 403httpRequestPack(void *obj, Packer *p)
2246b732 404{
5cafad19 405 HttpRequest *request = static_cast<HttpRequest*>(obj);
406 request->pack(p);
99edd1c3 407}
eeb423fb 408
2246b732 409/* returns the length of request line + headers + crlf */
410int
5cafad19 411HttpRequest::prefixLen()
2246b732 412{
60745f24 413 return strlen(RequestMethodStr(method)) + 1 +
5cafad19 414 urlpath.size() + 1 +
62e76326 415 4 + 1 + 3 + 2 +
5cafad19 416 header.len + 2;
2246b732 417}
99edd1c3 418
190154cf 419/* sync this routine when you update HttpRequest struct */
8596962e 420void
07947ad8 421HttpRequest::hdrCacheInit()
528b2c61 422{
07947ad8 423 HttpMsg::hdrCacheInit();
62e76326 424
66363092 425 assert(!range);
a9925b40 426 range = header.getRange();
528b2c61 427}
428
3ff65596 429#if ICAP_CLIENT
e1381638 430Adaptation::Icap::History::Pointer
3ff65596
AR
431HttpRequest::icapHistory() const
432{
433 if (!icapHistory_) {
38e16f92 434 if (Log::TheConfig.hasIcapToken || IcapLogfileStatus == LOG_ENABLE) {
3ff65596
AR
435 icapHistory_ = new Adaptation::Icap::History();
436 debugs(93,4, HERE << "made " << icapHistory_ << " for " << this);
437 }
438 }
439
440 return icapHistory_;
441}
442#endif
443
444#if USE_ADAPTATION
e1381638 445Adaptation::History::Pointer
a22e6cd3 446HttpRequest::adaptHistory(bool createIfNone) const
3ff65596 447{
a22e6cd3
AR
448 if (!adaptHistory_ && createIfNone) {
449 adaptHistory_ = new Adaptation::History();
450 debugs(93,4, HERE << "made " << adaptHistory_ << " for " << this);
3ff65596
AR
451 }
452
453 return adaptHistory_;
454}
a22e6cd3 455
e1381638 456Adaptation::History::Pointer
a22e6cd3
AR
457HttpRequest::adaptLogHistory() const
458{
38e16f92 459 return HttpRequest::adaptHistory(Log::TheConfig.hasAdaptToken);
a22e6cd3
AR
460}
461
aaf0559d
AR
462void
463HttpRequest::adaptHistoryImport(const HttpRequest &them)
464{
465 if (!adaptHistory_) {
466 adaptHistory_ = them.adaptHistory_; // may be nil
467 } else {
468 // check that histories did not diverge
469 Must(!them.adaptHistory_ || them.adaptHistory_ == adaptHistory_);
470 }
471}
472
3ff65596
AR
473#endif
474
528b2c61 475bool
190154cf 476HttpRequest::multipartRangeRequest() const
528b2c61 477{
478 return (range && range->specs.count > 1);
479}
8000a965 480
58217e94 481bool
9e008dda
AJ
482HttpRequest::bodyNibbled() const
483{
58217e94 484 return body_pipe != NULL && body_pipe->consumedSize() > 0;
485}
5f8252d2 486
64b66b76
CT
487void
488HttpRequest::detailError(err_type aType, int aDetail)
489{
490 if (errType || errDetail)
491 debugs(11, 5, HERE << "old error details: " << errType << '/' << errDetail);
492 debugs(11, 5, HERE << "current error details: " << aType << '/' << aDetail);
493 // checking type and detail separately may cause inconsistency, but
494 // may result in more details available if they only become available later
495 if (!errType)
496 errType = aType;
497 if (!errDetail)
498 errDetail = aDetail;
499}
500
129fe2a1
CT
501void
502HttpRequest::clearError()
503{
504 debugs(11, 7, HERE << "old error details: " << errType << '/' << errDetail);
505 errType = ERR_NONE;
506 errDetail = ERR_DETAIL_NONE;
507}
508
8596962e 509const char *HttpRequest::packableURI(bool full_uri) const
510{
511 if (full_uri)
512 return urlCanonical((HttpRequest*)this);
513
514 if (urlpath.size())
b4f2886c 515 return urlpath.termedBuf();
8596962e 516
517 return "/";
518}
519
520void HttpRequest::packFirstLineInto(Packer * p, bool full_uri) const
521{
522 // form HTTP request-line
523 packerPrintf(p, "%s %s HTTP/%d.%d\r\n",
60745f24 524 RequestMethodStr(method),
8596962e 525 packableURI(full_uri),
526 http_ver.major, http_ver.minor);
527}
8ddea643 528
529/*
684e9c80 530 * Indicate whether or not we would expect an entity-body
8ddea643 531 * along with this request
532 */
533bool
60745f24 534HttpRequest::expectingBody(const HttpRequestMethod& unused, int64_t& theSize) const
8ddea643 535{
536 bool expectBody = false;
537
538 /*
684e9c80
HN
539 * Note: Checks for message validity is in clientIsContentLengthValid().
540 * this just checks if a entity-body is expected based on HTTP message syntax
8ddea643 541 */
684e9c80 542 if (header.chunked()) {
8ddea643 543 expectBody = true;
684e9c80
HN
544 theSize = -1;
545 } else if (content_length >= 0) {
8ddea643 546 expectBody = true;
684e9c80
HN
547 theSize = content_length;
548 } else {
8ddea643 549 expectBody = false;
684e9c80 550 // theSize undefined
8ddea643 551 }
552
553 return expectBody;
554}
c21ad0f5 555
556/*
557 * Create a Request from a URL and METHOD.
558 *
559 * If the METHOD is CONNECT, then a host:port pair is looked for instead of a URL.
560 * If the request cannot be created cleanly, NULL is returned
561 */
562HttpRequest *
60745f24 563HttpRequest::CreateFromUrlAndMethod(char * url, const HttpRequestMethod& method)
c21ad0f5 564{
565 return urlParse(method, url, NULL);
566}
567
568/*
569 * Create a Request from a URL.
570 *
571 * If the request cannot be created cleanly, NULL is returned
572 */
573HttpRequest *
574HttpRequest::CreateFromUrl(char * url)
575{
c2a7cefd 576 return urlParse(Http::METHOD_GET, url, NULL);
c21ad0f5 577}
610ee341 578
c2a7cefd 579/**
610ee341 580 * Are responses to this request possible cacheable ?
581 * If false then no matter what the response must not be cached.
582 */
583bool
c2a7cefd 584HttpRequest::maybeCacheable()
610ee341 585{
2962f8b8
AJ
586 // Intercepted request with Host: header which cannot be trusted.
587 // Because it failed verification, or someone bypassed the security tests
588 // we cannot cache the reponse for sharing between clients.
589 // TODO: update cache to store for particular clients only (going to same Host: and destination IP)
0d901ef4 590 if (!flags.hostVerified && (flags.intercepted || flags.interceptTproxy))
2962f8b8
AJ
591 return false;
592
ffb82151 593 switch (protocol) {
c2a7cefd
AJ
594 case AnyP::PROTO_HTTP:
595 if (!method.respMaybeCacheable())
596 return false;
9e008dda 597
c2a7cefd
AJ
598 // XXX: this would seem the correct place to detect request cache-controls
599 // no-store, private and related which block cacheability
600 break;
610ee341 601
c2a7cefd
AJ
602 case AnyP::PROTO_GOPHER:
603 if (!gopherCachable(this))
604 return false;
605 break;
610ee341 606
c2a7cefd 607 case AnyP::PROTO_CACHE_OBJECT:
60745f24 608 return false;
610ee341 609
ffb82151 610 //case AnyP::PROTO_FTP:
c2a7cefd
AJ
611 default:
612 break;
613 }
614
60745f24 615 return true;
610ee341 616}
d67acb4e 617
79c8035e
AR
618bool
619HttpRequest::conditional() const
620{
45e5102d 621 return flags.ims ||
b59e6847
A
622 header.has(HDR_IF_MATCH) ||
623 header.has(HDR_IF_NONE_MATCH);
79c8035e
AR
624}
625
d5964067
AJ
626void
627HttpRequest::recordLookup(const DnsLookupDetails &dns)
3ff65596
AR
628{
629 if (dns.wait >= 0) { // known delay
630 if (dnsWait >= 0) // have recorded DNS wait before
631 dnsWait += dns.wait;
632 else
633 dnsWait = dns.wait;
634 }
635}
11e3fa1c
AJ
636
637int64_t
638HttpRequest::getRangeOffsetLimit()
639{
640 /* -2 is the starting value of rangeOffsetLimit.
641 * If it is -2, that means we haven't checked it yet.
642 * Otherwise, return the current value */
5e5f247c 643 if (rangeOffsetLimit != -2)
11e3fa1c
AJ
644 return rangeOffsetLimit;
645
646 rangeOffsetLimit = 0; // default value for rangeOffsetLimit
647
648 ACLFilledChecklist ch(NULL, this, NULL);
649 ch.src_addr = client_addr;
650 ch.my_addr = my_addr;
651
1328cfb7 652 for (AclSizeLimit *l = Config.rangeOffsetLimit; l; l = l -> next) {
11e3fa1c 653 /* if there is no ACL list or if the ACLs listed match use this limit value */
2efeb0b7 654 if (!l->aclList || ch.fastCheck(l->aclList) == ACCESS_ALLOWED) {
11e3fa1c
AJ
655 debugs(58, 4, HERE << "rangeOffsetLimit=" << rangeOffsetLimit);
656 rangeOffsetLimit = l->size; // may be -1
657 break;
658 }
659 }
660
661 return rangeOffsetLimit;
662}
655daa06
AR
663
664bool
665HttpRequest::canHandle1xx() const
666{
667 // old clients do not support 1xx unless they sent Expect: 100-continue
668 // (we reject all other HDR_EXPECT values so just check for HDR_EXPECT)
526ed14e 669 if (http_ver <= Http::ProtocolVersion(1,0) && !header.has(HDR_EXPECT))
655daa06
AR
670 return false;
671
672 // others must support 1xx control messages
673 return true;
674}
582c2af2
FC
675
676ConnStateData *
b0fb853f
A
677HttpRequest::pinnedConnection()
678{
582c2af2
FC
679 if (clientConnectionManager.valid() && clientConnectionManager->pinning.pinned)
680 return clientConnectionManager.get();
681 return NULL;
682}
a8a0b1c2
EC
683
684const char *
685HttpRequest::storeId()
686{
687 if (store_id.size() != 0) {
688 debugs(73, 3, "sent back store_id:" << store_id);
689
690 return store_id.termedBuf();
691 }
692 debugs(73, 3, "sent back canonicalUrl:" << urlCanonical(this) );
693
694 return urlCanonical(this);
695}