#include "squid.h"
#include "acl/FilledChecklist.h"
#include "anyp/PortCfg.h"
#include "base/AsyncCallbacks.h"
#include "base/Subscription.h"
#include "base/TextException.h"
#include "CachePeer.h"
#include "client_db.h"
#include "client_side.h"
#include "client_side_reply.h"
#include "client_side_request.h"
#include "ClientRequestContext.h"
#include "clientStream.h"
#include "comm.h"
#include "comm/Connection.h"
#include "comm/Loops.h"
#include "comm/Read.h"
#include "comm/TcpAcceptor.h"
#include "comm/Write.h"
#include "CommCalls.h"
#include "debug/Messages.h"
#include "error/ExceptionErrorDetail.h"
#include "errorpage.h"
#include "fd.h"
#include "fde.h"
#include "fqdncache.h"
#include "FwdState.h"
#include "globals.h"
#include "helper.h"
#include "helper/Reply.h"
#include "http.h"
#include "http/one/RequestParser.h"
#include "http/one/TeChunkedParser.h"
#include "http/Stream.h"
#include "HttpHdrContRange.h"
#include "HttpHeaderTools.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "ident/Config.h"
#include "ident/Ident.h"
#include "internal.h"
#include "ipc/FdNotes.h"
#include "ipc/StartListening.h"
#include "log/access_log.h"
#include "MemBuf.h"
#include "MemObject.h"
#include "mime_header.h"
#include "parser/Tokenizer.h"
#include "proxyp/Header.h"
#include "proxyp/Parser.h"
#include "sbuf/Stream.h"
#include "security/Certificate.h"
#include "security/CommunicationSecrets.h"
#include "security/Io.h"
#include "security/KeyLog.h"
#include "security/NegotiationHistory.h"
#include "servers/forward.h"
#include "SquidConfig.h"
#include "StatCounters.h"
#include "StatHist.h"
#include "Store.h"
#include "TimeOrTag.h"
#include "tools.h"
#include "auth/UserRequest.h"
#include "ClientInfo.h"
#include "MessageDelayPools.h"
#include "ssl/bio.h"
#include "ssl/context_storage.h"
#include "ssl/gadgets.h"
#include "ssl/helper.h"
#include "ssl/ProxyCerts.h"
#include "ssl/ServerBump.h"
#include "ssl/support.h"
#include <climits>
#include <cmath>
#include <limits>
Go to the source code of this file.
Classes | |
class | ListeningStartedDialer |
dials clientListenerConnectionOpened call More... | |
Variables | |
static IOACB | httpAccept |
static IDCB | clientIdentDone |
Function Documentation
◆ AddOpenedHttpSocket()
|
static |
Definition at line 3262 of file client_side.cc.
References conn, HttpSockets, and NHttpSockets.
Referenced by clientListenerConnectionOpened().
◆ buildUrlFromHost()
|
static |
Definition at line 1203 of file client_side.cc.
References conn, AnyP::UriScheme::image(), SBuf::length(), SQUIDSBUFPH, SQUIDSBUFPRINT, and xcalloc().
Referenced by ConnStateData::prepareTlsSwitchingURL(), and prepareTransparentURL().
◆ clientAclChecklistCreate()
ACLFilledChecklist * clientAclChecklistCreate | ( | const acl_access * | acl, |
ClientHttpRequest * | http | ||
) |
Definition at line 3486 of file client_side.cc.
References clientAclChecklistFill().
Referenced by clientReplyContext::blockedHit(), ClientRequestContext::checkNoCache(), ClientRequestContext::clientAccessCheck(), ClientRequestContext::clientAccessCheck2(), clientFollowXForwardedForCheck(), ClientRequestContext::clientRedirectStart(), ClientRequestContext::clientStoreIdStart(), clientReplyContext::processReplyAccess(), Http::Stream::sendStartOfMessage(), and ClientRequestContext::sslBumpAccessCheck().
◆ clientAclChecklistFill()
void clientAclChecklistFill | ( | ACLFilledChecklist & | checklist, |
ClientHttpRequest * | http | ||
) |
Definition at line 3494 of file client_side.cc.
References ACLFilledChecklist::al, ClientHttpRequest::al, assert, conn, ClientHttpRequest::getConn(), RefCount< C >::getRaw(), HTTPMSGLOCK(), ClientHttpRequest::log_uri, AccessLogEntry::reply, ACLFilledChecklist::reply, ACLFilledChecklist::request, ClientHttpRequest::request, ACLFilledChecklist::setConn(), ACLFilledChecklist::setRequest(), and ACLFilledChecklist::syncAle().
Referenced by clientAclChecklistCreate(), DelayId::DelayClient(), ConnStateData::fillChecklist(), clientReplyContext::fillChecklist(), and ConnStateData::serveDelayedError().
◆ clientConnectionsClose()
void clientConnectionsClose | ( | void | ) |
Definition at line 3398 of file client_side.cc.
References CodeContext::Current(), debugs, HttpPortList, HttpSockets, Important, NHttpSockets, CodeContext::Reset(), and Ftp::StopListening().
Referenced by releaseServerSockets(), and serverConnectionsClose().
◆ clientHttpConnectionsOpen()
|
static |
Definition at line 3273 of file client_side.cc.
References SquidConfig::accessList, Ssl::GlobalContextStorage::addLocalStorage(), assert, clientStartListeningOn(), commCbCall(), Config, CodeContext::Current(), DBG_CRITICAL, DBG_IMPORTANT, debugs, Debug::Extra(), Ipc::fdnHttpSocket, Ipc::fdnHttpsSocket, httpAccept, HttpPortList, httpsAccept(), AnyP::UriScheme::image(), MAXTCPLISTENPORTS, NHttpSockets, AnyP::PROTO_HTTP, AnyP::PROTO_HTTPS, CodeContext::Reset(), SquidConfig::ssl_bump, and Ssl::TheGlobalContextStorage.
Referenced by clientOpenListenSockets().
◆ clientIdentDone()
|
static |
Definition at line 203 of file client_side.cc.
References conn, dash_str, USER_IDENT_SZ, and xstrncpy().
◆ clientIsRequestBodyTooLargeForPolicy()
|
static |
Definition at line 710 of file client_side.cc.
References Config, and SquidConfig::maxRequestBodySize.
Referenced by clientProcessRequest(), and ConnStateData::handleChunkedRequestBody().
◆ clientListenerConnectionOpened()
|
static |
Definition at line 3350 of file client_side.cc.
References AddOpenedHttpSocket(), DBG_IMPORTANT, debugs, Debug::Extra(), Ipc::FdNote(), Important, Comm::IsConnOpen(), Must, OpenedHttpSocket(), opt_foreground, opt_no_daemon, AsyncJob::Start(), and xstrerr().
Referenced by clientStartListeningOn().
◆ clientNegotiateSSL()
|
static |
negotiate an SSL connection
Definition at line 2307 of file client_side.cc.
References clientNegotiateSSL(), COMM_SELECT_READ, COMM_SELECT_WRITE, conn, debug_log, debugs, Debug::Enabled(), ERR_SECURE_ACCEPT_FAIL, fd_table, Important, Security::IoResult::ioError, Security::IoResult::ioSuccess, Security::IoResult::ioWantRead, Security::IoResult::ioWantWrite, Security::IssuerName(), Http::METHOD_CONNECT, Must, Security::SessionIsResumed(), Comm::SetSelect(), and Security::SubjectName().
Referenced by clientNegotiateSSL(), ConnStateData::doPeekAndSpliceStep(), ConnStateData::getSslContextDone(), and httpsEstablish().
◆ clientOpenListenSockets()
void clientOpenListenSockets | ( | void | ) |
Definition at line 3388 of file client_side.cc.
References clientHttpConnectionsOpen(), fatal(), NHttpSockets, and Ftp::StartListening().
Referenced by serverConnectionsOpen().
◆ clientPackRangeHdr()
void clientPackRangeHdr | ( | const HttpReplyPointer & | rep, |
const HttpHdrRangeSpec * | spec, | ||
String | boundary, | ||
MemBuf * | mb | ||
) |
Definition at line 733 of file client_side.cc.
References MemBuf::append(), Packable::appendf(), assert, HttpHeader::clean(), Http::Message::content_length, Http::CONTENT_TYPE, debugs, HttpHeader::getStr(), HttpHeader::has(), Http::Message::header, hoReply, httpHeaderAddContRange(), HttpHeader::packInto(), HttpHeader::putStr(), SQUIDSTRINGPH, and SQUIDSTRINGPRINT.
Referenced by ClientHttpRequest::mRangeCLen(), and Http::Stream::packRange().
◆ clientPackTermBound()
Definition at line 726 of file client_side.cc.
References Packable::appendf(), debugs, MemBuf::size, SQUIDSTRINGPH, and SQUIDSTRINGPRINT.
Referenced by ClientHttpRequest::mRangeCLen(), and Http::Stream::packRange().
◆ clientPingHasFinished()
|
static |
Definition at line 267 of file client_side.cc.
References ping_data::start, and ping_data::stop.
Referenced by clientUpdateHierCounters().
◆ clientProcessRequest()
void clientProcessRequest | ( | ConnStateData * | conn, |
const Http1::RequestParserPointer & | hp, | ||
Http::Stream * | context | ||
) |
Definition at line 1588 of file client_side.cc.
References ClientHttpRequest::Flags::accel, RequestFlags::accelerated, ClientHttpRequest::al, assert, HttpRequest::auth_user_request, Http::Message::body_pipe, ClientHttpRequest::calloutContext, HttpRequest::checkEntityFraming(), ClientHttpRequest::checkForInternalAccess(), HttpHeader::chunked(), clientIsRequestBodyTooLargeForPolicy(), clientProcessRequestFinished(), clientSetKeepaliveFlag(), conn, Http::Message::content_length, debugs, ClientHttpRequest::doCallouts(), ERR_INVALID_REQ, ERR_TOO_BIG, ERR_UNSUP_REQ, ClientHttpRequest::flags, HttpRequest::flags, Http::Stream::getClientReplyContext(), HttpHeader::getInt64(), RefCount< C >::getRaw(), Http::Message::header, Http::Stream::http, Http::Message::http_ver, AnyP::ProtocolVersion::major, HttpRequest::manager(), Http::MAX_FORWARDS, Http::Stream::mayUseConnection(), HttpRequest::method, Http::METHOD_CONNECT, Http::METHOD_OPTIONS, AnyP::ProtocolVersion::minor, RequestFlags::noDirect, ClientHttpRequest::Out::offset, ClientHttpRequest::out, BodyPipe::productionEnded(), AnyP::PROTO_HTTPS, AnyP::ProtocolVersion::protocol, Http::Stream::pullData(), ClientHttpRequest::request, Http::scContentTooLarge, Http::scNone, Http::scNotImplemented, clientReplyContext::setReplyToError(), Http::Message::sources, Http::Message::srcFtp, Http::Message::srcHttp, Http::Message::srcHttps, RequestFlags::sslBumped, and urlCheckRequest().
Referenced by Ftp::Server::doProcessRequest(), Http::One::Server::proceedAfterBodyContinuation(), and Http::One::Server::processParsedRequest().
◆ clientProcessRequestFinished()
void clientProcessRequestFinished | ( | ConnStateData * | conn, |
const HttpRequest::Pointer & | request | ||
) |
Definition at line 1572 of file client_side.cc.
References comm_reset_close(), conn, debugs, HttpRequest::flags, Comm::IsConnOpen(), and RequestFlags::resetTcp.
Referenced by Http::One::Server::buildHttpRequest(), clientProcessRequest(), ConnStateData::fakeAConnectRequest(), ConnStateData::initiateTunneledRequest(), and Http::One::Server::processParsedRequest().
◆ clientSetKeepaliveFlag()
void clientSetKeepaliveFlag | ( | ClientHttpRequest * | http | ) |
clientSetKeepaliveFlag() sets request->flags.proxyKeepalive. This is the client-side persistent connection flag. We need to set this relatively early in the request processing to handle hacks for broken servers and clients.
Definition at line 698 of file client_side.cc.
References debugs, HttpRequest::flags, Http::Message::http_ver, HttpRequest::method, Http::Message::persistent(), RequestFlags::proxyKeepalive, and ClientHttpRequest::request.
Referenced by clientProcessRequest(), and Ftp::Server::doProcessRequest().
◆ ClientSocketContextPushDeferredIfNeeded()
|
static |
If the client stream is waiting on a socket write to occur, then
NO data is allowed to have been sent.
defer now.
otherwise, the request is still active in a callbacksomewhere, and we are done
Definition at line 896 of file client_side.cc.
References assert, clientSocketRecipient(), conn, and debugs.
Referenced by ConnStateData::doneWithControlMsg(), and ConnStateData::kick().
◆ clientSocketDetach()
void clientSocketDetach | ( | clientStreamNode * | node, |
ClientHttpRequest * | http | ||
) |
Called when a downstream node is no longer interested in our data. As we are a terminal node, this means on aborts only
Definition at line 860 of file client_side.cc.
References assert, cbdataReferenceValid(), clientStreamDetach(), and node::next.
Referenced by ConnStateData::abortRequestParsing(), ConnStateData::buildFakeRequest(), and ConnStateData::parseHttpRequest().
◆ clientSocketRecipient()
void clientSocketRecipient | ( | clientStreamNode * | node, |
ClientHttpRequest * | http, | ||
HttpReply * | rep, | ||
StoreIOBuffer | receivedData | ||
) |
Write a chunk of data to a client socket. If the reply is present, send the reply headers down the wire too, and clean them up when finished. Pre-condition: The request is one backed by a connection, not an internal request. data context is not NULL There are no more entries in the stream chain.
Definition at line 824 of file client_side.cc.
References assert, HttpControlMsgSink::cbControlMsgSent, cbdataReferenceValid(), Server::clientConnection, Pipeline::front(), ClientHttpRequest::getConn(), ConnStateData::handleReply(), Comm::IsConnOpen(), node::next, and Server::pipeline.
Referenced by ConnStateData::abortRequestParsing(), ConnStateData::buildFakeRequest(), ClientSocketContextPushDeferredIfNeeded(), and ConnStateData::parseHttpRequest().
◆ clientStartListeningOn()
void clientStartListeningOn | ( | AnyP::PortCfgPointer & | port, |
const RefCount< CommCbFunPtrCallT< CommAcceptCbPtrFun > > & | subCall, | ||
const Ipc::FdNoteId | fdNote | ||
) |
Definition at line 3322 of file client_side.cc.
References assert, asyncCall(), clientListenerConnectionOpened(), COMM_INTERCEPTION, COMM_NONBLOCKING, COMM_REUSEPORT, COMM_TRANSPARENT, HttpSockets, MAXTCPLISTENPORTS, NHttpSockets, port, and Ipc::StartListening().
Referenced by clientHttpConnectionsOpen(), and Ftp::StartListening().
◆ clientUpdateHierCounters()
|
static |
Definition at line 276 of file client_side.cc.
References StatCounters::cd, CD_PARENT_HIT, CD_SIBLING_HIT, clientPingHasFinished(), CLOSEST_DIRECT, CLOSEST_PARENT, CLOSEST_PARENT_MISS, HierarchyLogEntry::code, StatHist::count(), FIRST_PARENT_MISS, StatCounters::icp, StatCounters::netdb, PARENT_HIT, HierarchyLogEntry::ping, StatCounters::query_timeouts, StatCounters::querySvcTime, SIBLING_HIT, ping_data::start, statCounter, ping_data::stop, ping_data::timeout, StatCounters::times_used, and tvSubUsec().
Referenced by ClientHttpRequest::updateCounters().
◆ clientUpdateStatCounters()
|
static |
Definition at line 211 of file client_side.cc.
References StatCounters::client_http, StatCounters::disk_hits, StatCounters::hits, LogTags::isTcpHit(), LOG_TCP_HIT, LOG_TCP_MEM_HIT, StatCounters::mem_hits, LogTags::oldType, StatCounters::requests, and statCounter.
Referenced by ClientHttpRequest::updateCounters().
◆ clientUpdateStatHistCounters()
The idea here is not to be complete, but to get service times for only well-defined types. For example, we don't include LOG_TCP_REFRESH_FAIL because its not really a cache hit (we tried to validate it, but failed).
Definition at line 225 of file client_side.cc.
References StatCounters::allSvcTime, StatCounters::client_http, StatHist::count(), StatCounters::hitSvcTime, LOG_TCP_CLIENT_REFRESH_MISS, LOG_TCP_HIT, LOG_TCP_IMS_HIT, LOG_TCP_INM_HIT, LOG_TCP_MEM_HIT, LOG_TCP_MISS, LOG_TCP_OFFLINE_HIT, LOG_TCP_REFRESH_UNMODIFIED, StatCounters::missSvcTime, StatCounters::nearHitSvcTime, StatCounters::nearMissSvcTime, LogTags::oldType, and statCounter.
Referenced by ClientHttpRequest::updateCounters().
◆ findTrailingHTTPVersion()
const char * findTrailingHTTPVersion | ( | const char * | uriAndHTTPVersion, |
const char * | end | ||
) |
'end' defaults to NULL for backwards compatibility remove default value if we ever get rid of NULL-terminated request buffers.
Definition at line 1076 of file client_side.cc.
References assert, and xisspace.
Referenced by HttpRequest::parseFirstLine().
◆ httpAccept()
void httpAccept | ( | const CommAcceptCbParams & | params | ) |
Handle a new connection on an HTTP socket.
Definition at line 2267 of file client_side.cc.
References Assure, CommCommonCbParams::conn, debugs, Comm::Connection::fd, fd_note(), CommCommonCbParams::flag, MasterXaction::MakePortful(), Http::NewServer(), Comm::OK, CommAcceptCbParams::port, AsyncJob::Start(), CommCommonCbParams::xerrno, and xstrerr().
◆ httpRequestFree()
void httpRequestFree | ( | void * | data | ) |
Definition at line 499 of file client_side.cc.
References assert.
Referenced by Http::Stream::~Stream(), and esiBufferRecipient().
◆ httpsAccept()
|
static |
handle a new HTTPS connection
Definition at line 2469 of file client_side.cc.
References Assure, CommCommonCbParams::conn, debugs, Comm::Connection::fd, fd_note(), CommCommonCbParams::flag, MasterXaction::MakePortful(), Https::NewServer(), Comm::OK, CommAcceptCbParams::port, AsyncJob::Start(), CommCommonCbParams::xerrno, and xstrerr().
Referenced by clientHttpConnectionsOpen().
◆ httpsCreate()
|
static |
Definition at line 2292 of file client_side.cc.
References Server::clientConnection, conn, Security::CreateServerSession(), DBG_IMPORTANT, debugs, and ConnStateData::port.
Referenced by ConnStateData::getSslContextDone(), httpsEstablish(), and ConnStateData::startPeekAndSplice().
◆ httpsEstablish()
|
static |
If Security::ContextPointer is given, starts reading the TLS handshake. Otherwise, calls switchToHttps to generate a dynamic Security::ContextPointer.
Definition at line 2423 of file client_side.cc.
References assert, Server::clientConnection, clientNegotiateSSL(), COMM_SELECT_READ, Config, Comm::Connection::fd, httpsCreate(), SquidConfig::request, ConnStateData::resetReadTimeout(), Comm::SetSelect(), and SquidConfig::Timeout.
Referenced by ConnStateData::postHttpsAccept().
◆ httpsSslBumpAccessCheckDone()
|
static |
A callback function to use with the ACLFilledChecklist callback.
Definition at line 2441 of file client_side.cc.
References Acl::Answer::allowed(), Ssl::bumpMode(), Ssl::bumpSplice, Ssl::bumpTerminate, Server::clientConnection, Comm::Connection::close(), debugs, ConnStateData::fakeAConnectRequest(), Server::inBuf, ConnStateData::isOpen(), Acl::Answer::kind, and ConnStateData::sslBumpMode.
Referenced by ConnStateData::postHttpsAccept().
◆ httpsSslBumpStep2AccessCheckDone()
|
static |
Definition at line 2928 of file client_side.cc.
References Ssl::ServerBump::act, Acl::Answer::allowed(), assert, Ssl::bumpSplice, Ssl::bumpTerminate, Server::clientConnection, Comm::Connection::close(), debugs, Pipeline::front(), ConnStateData::isOpen(), Acl::Answer::kind, Server::pipeline, ConnStateData::serverBump(), ConnStateData::splice(), ConnStateData::sslBumpMode, ConnStateData::startPeekAndSplice(), and Ssl::ServerBump::step2.
Referenced by ConnStateData::startPeekAndSplice().
◆ OpenedHttpSocket()
|
static |
Definition at line 3245 of file client_side.cc.
References fatalf(), Ipc::FdNote(), HttpSockets, Comm::IsConnOpen(), Must, and NHttpSockets.
Referenced by clientListenerConnectionOpened().
◆ operator<<() [1/2]
std::ostream & operator<< | ( | std::ostream & | os, |
const ConnStateData::PinnedIdleContext & | pic | ||
) |
Definition at line 4049 of file client_side.cc.
References ConnStateData::PinnedIdleContext::connection, and ConnStateData::PinnedIdleContext::request.
◆ operator<<() [2/2]
std::ostream & operator<< | ( | std::ostream & | os, |
const ConnStateData::ServerConnectionContext & | scc | ||
) |
Definition at line 4055 of file client_side.cc.
◆ prepareAcceleratedURL()
|
static |
Definition at line 1099 of file client_side.cc.
References CharacterSet::ALPHA, SBuf::append(), SBuf::appendf(), SBuf::chop(), conn, debugs, CharacterSet::DIGIT, CharacterSet::HEXDIG, AnyP::UriScheme::image(), SBuf::isEmpty(), SBuf::length(), MAX_IPSTRLEN, SBuf::npos, SBuf::rbegin(), SBuf::rfind(), Http::scBadRequest, SQUIDSBUFPH, SQUIDSBUFPRINT, and xcalloc().
Referenced by ConnStateData::parseHttpRequest().
◆ prepareLogWithRequestDetails()
void prepareLogWithRequestDetails | ( | HttpRequest * | request, |
const AccessLogEntryPointer & | aLogEntry | ||
) |
Definition at line 335 of file client_side.cc.
References AccessLogEntry::adapt, AccessLogEntry::Headers::adapted_request, HttpRequest::adaptLogHistory(), assert, MemBuf::buf, AccessLogEntry::cache, MemBuf::clean(), Config, HttpRequest::dnsWait, HttpRequest::error, HttpRequest::extacl_user, AccessLogEntry::CacheDetails::extuser, Http::Message::header, AccessLogEntry::headers, AccessLogEntry::hier, HttpRequest::hier, AccessLogEntry::http, Http::Message::http_ver, AccessLogEntry::icap, HttpRequest::icapHistory(), MemBuf::init(), AccessLogEntry::AdaptationDetails::last_meta, Adaptation::History::lastMeta, SquidConfig::log_mime_hdrs, AccessLogEntry::HttpDetails::method, HttpRequest::method, SquidConfig::onoff, HttpHeader::packInto(), AccessLogEntry::IcapLogEntry::processingTime, AccessLogEntry::Headers::request, AccessLogEntry::request, MemBuf::reset(), String::termedBuf(), AccessLogEntry::HttpDetails::version, and xstrdup.
Referenced by Adaptation::Icap::ModXact::finalizeLogInfo(), and ClientHttpRequest::logRequest().
◆ prepareTransparentURL()
|
static |
Definition at line 1254 of file client_side.cc.
References buildUrlFromHost(), conn, debugs, AnyP::UriScheme::image(), MAX_IPSTRLEN, SQUIDSBUFPH, SQUIDSBUFPRINT, and xcalloc().
Referenced by ConnStateData::parseHttpRequest().
◆ skipLeadingSpace()
char * skipLeadingSpace | ( | char * | aString | ) |
Definition at line 1060 of file client_side.cc.
References xisspace.
◆ varyEvaluateMatch()
int varyEvaluateMatch | ( | StoreEntry * | entry, |
HttpRequest * | request | ||
) |
Definition at line 3422 of file client_side.cc.
References SBuf::clear(), SBuf::cmp(), DBG_IMPORTANT, debugs, MemObject::freshestReply(), HttpHeader::has(), Http::HDR_X_ACCELERATOR_VARY, Http::Message::header, httpMakeVaryMark(), SBuf::isEmpty(), StoreEntry::mem(), StoreEntry::mem_obj, MemObject::urlXXX(), Http::VARY, VARY_CANCEL, HttpRequest::vary_headers, MemObject::vary_headers, VARY_MATCH, VARY_NONE, and VARY_OTHER.
Referenced by clientReplyContext::cacheHit().
Variable Documentation
◆ clientIdentDone
|
static |
Definition at line 188 of file client_side.cc.
Referenced by ConnStateData::whenClientIpKnown().
◆ httpAccept
|
static |
Definition at line 186 of file client_side.cc.
Referenced by clientHttpConnectionsOpen().