#include "squid.h"
#include "acl/FilledChecklist.h"
#include "acl/Gadgets.h"
#include "anyp/PortCfg.h"
#include "base/AsyncJobCalls.h"
#include "client_side.h"
#include "client_side_reply.h"
#include "client_side_request.h"
#include "ClientRequestContext.h"
#include "clientStream.h"
#include "comm/Connection.h"
#include "comm/Write.h"
#include "error/Detail.h"
#include "errorpage.h"
#include "fd.h"
#include "fde.h"
#include "format/Token.h"
#include "FwdState.h"
#include "helper.h"
#include "helper/Reply.h"
#include "http.h"
#include "http/Stream.h"
#include "HttpHdrCc.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "internal.h"
#include "ip/NfMarkConfig.h"
#include "ip/QosConfig.h"
#include "ipcache.h"
#include "log/access_log.h"
#include "MemObject.h"
#include "Parsing.h"
#include "proxyp/Header.h"
#include "redirect.h"
#include "rfc1738.h"
#include "sbuf/StringConvert.h"
#include "SquidConfig.h"
#include "Store.h"
#include "StrList.h"
#include "tools.h"
#include "wordlist.h"
#include "auth/UserRequest.h"
#include "adaptation/AccessCheck.h"
#include "adaptation/Answer.h"
#include "adaptation/Iterator.h"
#include "adaptation/Service.h"
#include "adaptation/icap/History.h"
#include "ssl/ServerBump.h"
#include "ssl/support.h"
Go to the source code of this file.
Macros | |
#define | FAILURE_MODE_TIME 300 |
Variables | |
static HLPCB | clientRedirectDoneWrapper |
static HLPCB | clientStoreIdDoneWrapper |
SQUIDCEXTERN CSR | clientGetMoreData |
SQUIDCEXTERN CSS | clientReplyStatus |
SQUIDCEXTERN CSD | clientReplyDetach |
Macro Definition Documentation
◆ FAILURE_MODE_TIME
#define FAILURE_MODE_TIME 300 |
Function Documentation
◆ checkFailureRatio()
This function is designed to serve a fairly specific purpose. Occasionally our vBNS-connected caches can talk to each other, but not the rest of the world. Here we try to detect frequent failures which make the cache unusable (e.g. DNS lookup and connect() failures). If the failure:success ratio goes above 1.0 then we go into "hit only" mode where we only return UDP_HIT or UDP_MISS_NOFETCH. Neighbors will only fetch HITs from us if they are using the ICP protocol. We stay in this mode for 5 minutes.
Duane W., Sept 16, 1996
Definition at line 174 of file client_side_request.cc.
References Config, DBG_CRITICAL, debugs, ERR_CONNECT_FAIL, ERR_DNS_FAIL, ERR_READ_ERROR, ERR_SECURE_CONNECT_FAIL, FAILURE_MODE_TIME, HIER_NONE, hit_only_mode_until, SquidConfig::icp, SquidConfig::Port, request_failure_ratio, and squid_curtime.
Referenced by ClientHttpRequest::~ClientHttpRequest().
◆ checkNoCacheDoneWrapper()
|
static |
Definition at line 1322 of file client_side_request.cc.
References ClientRequestContext::checkNoCacheDone(), and ClientRequestContext::httpStateIsValid().
Referenced by ClientRequestContext::checkNoCache().
◆ clientAccessCheckDoneWrapper()
|
static |
Definition at line 690 of file client_side_request.cc.
References ClientRequestContext::clientAccessCheckDone(), and ClientRequestContext::httpStateIsValid().
Referenced by ClientRequestContext::clientAccessCheck(), and ClientRequestContext::clientAccessCheck2().
◆ clientBeginRequest()
int clientBeginRequest | ( | const HttpRequestMethod & | method, |
char const * | url, | ||
CSCB * | streamcallback, | ||
CSD * | streamdetach, | ||
ClientStreamData | streamdata, | ||
HttpHeader const * | header, | ||
char * | tailbuf, | ||
size_t | taillen, | ||
const MasterXaction::Pointer & | mx | ||
) |
Create a request and kick it off
- Return values
-
0 success -1 failure
TODO: Pass in the buffers to be used in the initial Read request, as they are determined by the user
Definition at line 277 of file client_side_request.cc.
References ClientHttpRequest::Flags::accel, RequestFlags::accelerated, ClientHttpRequest::al, SquidConfig::appendDomainLen, AccessLogEntry::cache, ClientHttpRequest::calloutContext, HttpRequest::client_addr, ClientHttpRequest::client_stream, clientGetMoreData, clientReplyDetach, clientReplyStatus, clientStreamInit(), Config, Http::Message::content_length, current_time, StoreIOBuffer::data, debugs, ClientHttpRequest::doCallouts(), ClientHttpRequest::flags, HttpRequest::flags, HttpRequest::FromUrlXXX(), Http::Message::header, ClientRequestContext::http_access_done, Http::Message::http_ver, HttpRequest::indirect_client_addr, ClientHttpRequest::initRequest(), StoreIOBuffer::length, HttpRequest::my_addr, ClientRequestContext::no_cache_done, Ip::Address::port(), Http::ProtocolVersion(), ClientRequestContext::redirect_done, ClientHttpRequest::req_sz, Ip::Address::setNoAddr(), AccessLogEntry::CacheDetails::start_time, HttpHeader::update(), ClientHttpRequest::uri, and xcalloc().
Referenced by ESIInclude::Start().
◆ clientBuildError()
ErrorState * clientBuildError | ( | err_type | page_id, |
Http::StatusCode | status, | ||
char const * | url, | ||
const ConnStateData * | conn, | ||
HttpRequest * | request, | ||
const AccessLogEntry::Pointer & | al | ||
) |
Definition at line 2134 of file client_side_reply.cc.
Referenced by ClientHttpRequest::calloutsError(), and ClientRequestContext::clientAccessCheckDone().
◆ clientCheckPinning()
|
static |
Definition at line 921 of file client_side_request.cc.
References assert, ConnStateData::auth, RequestFlags::auth, Http::AUTHORIZATION, HttpRequest::clientConnectionManager, RequestFlags::connectionAuth, RequestFlags::connectionAuthDisabled, RequestFlags::connectionProxyAuth, HttpRequest::flags, ClientHttpRequest::getConn(), HttpHeader::getEntry(), HttpHeader::has(), Http::Message::header, HttpHeaderInitPos, HttpHeaderEntry::id, Comm::IsConnOpen(), HttpRequest::pinnedConnection(), ConnStateData::pinning, ConnStateData::port, Http::PROXY_AUTHORIZATION, String::rawBuf(), ClientHttpRequest::request, ConnStateData::serverConnection, and HttpHeaderEntry::value.
Referenced by clientInterpretRequestHeaders().
◆ clientFollowXForwardedForCheck()
|
static |
clientFollowXForwardedForCheck() checks the content of X-Forwarded-For: against the followXFF ACL, or cleans up and passes control to clientAccessCheck().
The trust model here is a little ambiguous. So to clarify the logic:
- we may always use the direct client address as the client IP.
- these trust tests merey tell whether we trust given IP enough to believe the IP string which it appended to the X-Forwarded-For: header.
- if at any point we don't trust what an IP adds we stop looking.
- at that point the current contents of indirect_client_addr are the value set by the last previously trusted IP. ++ indirect_client_addr contains the remote direct client from the trusted peers viewpoint.
Definition at line 393 of file client_side_request.cc.
References SquidConfig::accessList, ClientRequestContext::acl_checklist, SquidConfig::acl_uses_indirect_client, ClientHttpRequest::al, Acl::Answer::allowed(), AccessLogEntry::cache, AccessLogEntry::CacheDetails::caddr, String::clean(), ClientRequestContext::clientAccessCheck(), clientAclChecklistCreate(), clientFollowXForwardedForCheck(), Config, Acl::Answer::conflicted(), conn, String::cut(), DBG_CRITICAL, debugs, RequestFlags::done_follow_x_forwarded_for, Filled(), HttpRequest::flags, SquidConfig::followXFF, ClientHttpRequest::getConn(), ClientRequestContext::http, ClientRequestContext::httpStateIsValid(), HttpRequest::indirect_client_addr, SquidConfig::log_uses_indirect_client, ACLChecklist::nonBlockingCheck(), SquidConfig::onoff, ClientHttpRequest::request, String::size(), ACLFilledChecklist::src_addr, String::termedBuf(), HttpRequest::x_forwarded_for_iterator, and xisspace.
Referenced by ClientRequestContext::clientAccessCheck(), and clientFollowXForwardedForCheck().
◆ clientHierarchical()
|
static |
Definition at line 881 of file client_side_request.cc.
References RequestFlags::auth, HttpRequest::flags, AnyP::Uri::getScheme(), RequestFlags::hostVerified, RequestFlags::ims, RequestFlags::intercepted, RequestFlags::interceptTproxy, RequestFlags::loopDetected, HttpRequest::method, Http::METHOD_GET, Http::METHOD_TRACE, neighbors_do_private_keys, AnyP::PROTO_HTTP, ClientHttpRequest::request, HttpRequestMethod::respMaybeCacheable(), and HttpRequest::url.
Referenced by clientInterpretRequestHeaders().
◆ clientInterpretRequestHeaders()
|
static |
Definition at line 984 of file client_side_request.cc.
References SquidConfig::Accel, RequestFlags::accelerated, RequestFlags::auth, Http::AUTHORIZATION, RequestFlags::cachable, Http::Message::cache_control, Http::CDN_LOOP, String::clean(), ClientHttpRequest::client_stream, clientCheckPinning(), clientHierarchical(), Config, dlink_node::data, DBG_IMPORTANT, debugObj(), debugs, HttpHeader::delById(), HttpRequest::flags, fvdbCountForwarded(), fvdbCountVia(), HttpHeader::getList(), HttpHeader::getRange(), HttpHeader::getTime(), HttpHeader::has(), HttpHeader::hasListMember(), HttpHdrCc::hasNoCache(), Http::Message::header, RequestFlags::hierarchical, httpRequestPack(), Http::IF_MODIFIED_SINCE, RequestFlags::ignoreCc, HttpRequest::ignoreRange(), HttpRequest::ims, RequestFlags::ims, HttpRequest::imslen, RequestFlags::isRanged, RequestFlags::loopDetected, HttpHdrRange::lowestOffset(), HttpRequest::maybeCacheable(), HttpRequest::method, Http::METHOD_GET, Http::METHOD_HEAD, Http::METHOD_OTHER, RequestFlags::noCache, RequestFlags::nocacheHack, SquidConfig::onoff, Http::PRAGMA, Http::RANGE, HttpRequest::range, refresh_nocache_hack, SquidConfig::reload_into_ims, ClientHttpRequest::request, Http::REQUEST_RANGE, StringToSBuf(), strListIsSubstr(), SupportOrVeto::support(), SquidConfig::surrogate_id, dlink_list::tail, ThisCache2, HttpRequest::url, AnyP::Uri::userInfo(), SupportOrVeto::veto(), Http::VIA, and Http::X_FORWARDED_FOR.
Referenced by ClientHttpRequest::doCallouts().
◆ clientRedirectAccessCheckDone()
|
static |
Definition at line 817 of file client_side_request.cc.
References ClientRequestContext::acl_checklist, Acl::Answer::allowed(), ClientRequestContext::clientRedirectDone(), clientRedirectDoneWrapper, Helper::Error, ClientRequestContext::http, and redirectStart().
Referenced by ClientRequestContext::clientRedirectStart().
◆ clientRedirectDoneWrapper()
void clientRedirectDoneWrapper | ( | void * | data, |
const Helper::Reply & | result | ||
) |
Definition at line 1121 of file client_side_request.cc.
References ClientRequestContext::clientRedirectDone(), and ClientRequestContext::httpStateIsValid().
◆ clientStoreIdAccessCheckDone()
|
static |
This methods handles Access checks result of StoreId access list. Will handle as "ERR" (no change) in a case Access is not allowed.
Definition at line 848 of file client_side_request.cc.
References ClientRequestContext::acl_checklist, Acl::Answer::allowed(), ClientRequestContext::clientStoreIdDone(), clientStoreIdDoneWrapper, debugs, Helper::Error, ClientRequestContext::http, and storeIdStart().
Referenced by ClientRequestContext::clientStoreIdStart().
◆ clientStoreIdDoneWrapper()
void clientStoreIdDoneWrapper | ( | void * | data, |
const Helper::Reply & | result | ||
) |
Definition at line 1132 of file client_side_request.cc.
References ClientRequestContext::clientStoreIdDone(), and ClientRequestContext::httpStateIsValid().
◆ hostHeaderIpVerifyWrapper()
|
static |
Definition at line 470 of file client_side_request.cc.
References ClientRequestContext::hostHeaderIpVerify().
Referenced by ClientRequestContext::hostHeaderVerify().
◆ sslBumpAccessCheckDoneWrapper()
|
static |
A wrapper function to use the ClientRequestContext::sslBumpAccessCheckDone method as ACLFilledChecklist callback
Definition at line 1419 of file client_side_request.cc.
References ClientRequestContext::httpStateIsValid(), and ClientRequestContext::sslBumpAccessCheckDone().
Referenced by ClientRequestContext::sslBumpAccessCheck().
◆ SslBumpEstablish()
|
static |
Definition at line 1506 of file client_side_request.cc.
References assert, cbdataReferenceValid(), debugs, and ClientHttpRequest::sslBumpEstablish().
Referenced by ClientHttpRequest::sslBumpStart().
Variable Documentation
◆ clientGetMoreData
SQUIDCEXTERN CSR clientGetMoreData |
Definition at line 96 of file client_side_request.cc.
Referenced by clientBeginRequest(), and ClientHttpRequest::handleAdaptedHeader().
◆ clientRedirectDoneWrapper
|
static |
Definition at line 93 of file client_side_request.cc.
Referenced by clientRedirectAccessCheckDone(), and ClientRequestContext::clientRedirectStart().
◆ clientReplyDetach
SQUIDCEXTERN CSD clientReplyDetach |
Definition at line 98 of file client_side_request.cc.
Referenced by clientBeginRequest().
◆ clientReplyStatus
SQUIDCEXTERN CSS clientReplyStatus |
Definition at line 97 of file client_side_request.cc.
Referenced by clientBeginRequest().
◆ clientStoreIdDoneWrapper
|
static |
Definition at line 94 of file client_side_request.cc.
Referenced by clientStoreIdAccessCheckDone(), and ClientRequestContext::clientStoreIdStart().