client_side_request.cc File Reference
#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 "debug/Messages.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 SQUID_X_FORWARDED_FOR_HOP_MAX   64
 
#define FAILURE_MODE_TIME   300
 

Functions

static void clientFollowXForwardedForCheck (Acl::Answer answer, void *data)
 
ErrorStateclientBuildError (err_type, Http::StatusCode, char const *url, const ConnStateData *, HttpRequest *, const AccessLogEntry::Pointer &)
 
static void clientAccessCheckDoneWrapper (Acl::Answer, void *)
 
static void sslBumpAccessCheckDoneWrapper (Acl::Answer, void *)
 
static int clientHierarchical (ClientHttpRequest *http)
 
static void clientInterpretRequestHeaders (ClientHttpRequest *http)
 
static void checkNoCacheDoneWrapper (Acl::Answer, void *)
 
static void checkFailureRatio (err_type, hier_code)
 
static void hostHeaderIpVerifyWrapper (const ipcache_addrs *ia, const Dns::LookupDetails &dns, void *data)
 
static void clientRedirectAccessCheckDone (Acl::Answer answer, void *data)
 
static void clientStoreIdAccessCheckDone (Acl::Answer answer, void *data)
 
static void clientCheckPinning (ClientHttpRequest *http)
 
void clientRedirectDoneWrapper (void *data, const Helper::Reply &result)
 
void clientStoreIdDoneWrapper (void *data, const Helper::Reply &result)
 
static void SslBumpEstablish (const Comm::ConnectionPointer &, char *, size_t, Comm::Flag errflag, int, void *data)
 

Variables

static HLPCB clientRedirectDoneWrapper
 
static HLPCB clientStoreIdDoneWrapper
 
CSR clientGetMoreData
 
CSS clientReplyStatus
 
CSD clientReplyDetach
 

Macro Definition Documentation

◆ FAILURE_MODE_TIME

#define FAILURE_MODE_TIME   300

◆ SQUID_X_FORWARDED_FOR_HOP_MAX

#define SQUID_X_FORWARDED_FOR_HOP_MAX   64

Definition at line 81 of file client_side_request.cc.

Function Documentation

◆ checkFailureRatio()

static void checkFailureRatio ( err_type  etype,
hier_code  hcode 
)
static

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 179 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 void checkNoCacheDoneWrapper ( Acl::Answer  answer,
void *  data 
)
static

◆ clientAccessCheckDoneWrapper()

void clientAccessCheckDoneWrapper ( Acl::Answer  answer,
void *  data 
)
static

◆ clientBuildError()

◆ clientCheckPinning()

◆ clientFollowXForwardedForCheck()

static void clientFollowXForwardedForCheck ( Acl::Answer  answer,
void *  data 
)
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 302 of file client_side_request.cc.

References SquidConfig::accessList, SquidConfig::acl_uses_indirect_client, ClientHttpRequest::al, Acl::Answer::allowed(), String::clean(), ClientRequestContext::clientAccessCheck(), clientAclChecklistCreate(), Config, Acl::Answer::conflicted(), ClientRequestContext::currentXffHopNumber, String::cut(), DBG_CRITICAL, debugs, RequestFlags::done_follow_x_forwarded_for, Debug::Extra(), HttpRequest::flags, SquidConfig::followXFF, ClientHttpRequest::getConn(), Http::HeaderLookupTable, ClientRequestContext::http, ClientRequestContext::httpStateIsValid(), HttpRequest::indirect_client_addr, SquidConfig::log_uses_indirect_client, Http::HeaderLookupTable_t::lookup(), Http::HeaderTableRecord::name, ACLFilledChecklist::NonBlockingCheck(), SquidConfig::onoff, ClientHttpRequest::request, String::size(), SQUID_X_FORWARDED_FOR_HOP_MAX, String::termedBuf(), Http::X_FORWARDED_FOR, HttpRequest::x_forwarded_for_iterator, and xisspace.

Referenced by ClientRequestContext::clientAccessCheck().

◆ clientHierarchical()

◆ clientInterpretRequestHeaders()

static void clientInterpretRequestHeaders ( ClientHttpRequest http)
static

◆ clientRedirectAccessCheckDone()

static void clientRedirectAccessCheckDone ( Acl::Answer  answer,
void *  data 
)
static

◆ clientRedirectDoneWrapper()

void clientRedirectDoneWrapper ( void *  data,
const Helper::Reply result 
)

◆ clientStoreIdAccessCheckDone()

static void clientStoreIdAccessCheckDone ( Acl::Answer  answer,
void *  data 
)
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 754 of file client_side_request.cc.

References 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 
)

◆ hostHeaderIpVerifyWrapper()

static void hostHeaderIpVerifyWrapper ( const ipcache_addrs ia,
const Dns::LookupDetails dns,
void *  data 
)
static

◆ sslBumpAccessCheckDoneWrapper()

static void sslBumpAccessCheckDoneWrapper ( Acl::Answer  answer,
void *  data 
)
static

◆ SslBumpEstablish()

static void SslBumpEstablish ( const Comm::ConnectionPointer ,
char *  ,
size_t  ,
Comm::Flag  errflag,
int  ,
void *  data 
)
static

Variable Documentation

◆ clientGetMoreData

CSR clientGetMoreData

Definition at line 102 of file client_side_request.cc.

Referenced by ClientHttpRequest::handleAdaptedHeader().

◆ clientRedirectDoneWrapper

HLPCB clientRedirectDoneWrapper
static

◆ clientReplyDetach

CSD clientReplyDetach

Definition at line 104 of file client_side_request.cc.

◆ clientReplyStatus

CSS clientReplyStatus

Definition at line 103 of file client_side_request.cc.

◆ clientStoreIdDoneWrapper

HLPCB clientStoreIdDoneWrapper
static

 

Introduction

Documentation

Support

Miscellaneous