FwdState.cc
Go to the documentation of this file.
120 FwdState::FwdState(const Comm::ConnectionPointer &client, StoreEntry * e, HttpRequest * r, const AccessLogEntryPointer &alp):
159 AsyncCall::Pointer call = asyncCall(17, 4, "FwdState::Abort", cbdataDialer(&FwdState::HandleStoreAbort, this));
170 const bool isIntercepted = request && !request->flags.redirected && (request->flags.intercepted || request->flags.interceptTproxy);
171 const bool useOriginalDst = Config.onoff.client_dst_passthru || (request && !request->flags.hostVerified);
246 const auto lte = LogTagsErrors::FromErrno(err->type == ERR_READ_TIMEOUT ? ETIMEDOUT : err->xerrno);
287 ConnStateData::httpsPeeked, ConnStateData::PinnedIdleContext(Comm::ConnectionPointer(nullptr), request));
338 FwdState::Start(const Comm::ConnectionPointer &clientConn, StoreEntry *entry, HttpRequest *request, const AccessLogEntryPointer &al)
407 FwdState::fwdStart(const Comm::ConnectionPointer &clientConn, StoreEntry *entry, HttpRequest *request)
449 const auto anErr = new ErrorState(ERR_CANNOT_FORWARD, Http::scInternalServerError, request, al);
555 debugs(17, 3, "server FD " << serverConnection()->fd << " not re-forwarding status " << replyStatus);
776 debugs(17, 3, "re-forwarding (" << n_tries << " tries, " << (squid_curtime - start_t) << " secs)");
820 FwdState::advanceDestination(const char *stepDescription, const Comm::ConnectionPointer &conn, const StepStart &startStep)
912 const auto tunneler = new Http::Tunneler(conn, requestPointer, callback, connectingTimeout(conn), al);
942 closePendingConnection(answer.conn, "conn was closed while waiting for tunnelEstablishmentDone");
977 const bool clientFirstBump = request->flags.sslBumped; // client-first (already) bumped connection
982 const bool needTlsToOrigin = !p && request->url.getScheme() == AnyP::PROTO_HTTPS && !clientFirstBump;
1004 connector = new Ssl::PeekingPeerConnector(requestPointer, conn, clientConn, callback, al, sslNegotiationTimeout);
1007 connector = new Security::BlindPeerConnector(requestPointer, conn, callback, al, sslNegotiationTimeout);
1065 FwdState::syncWithServerConn(const Comm::ConnectionPointer &conn, const char *host, const bool reused)
1222 clientFde->nfConnmarkFromServer = Ip::Qos::getNfConnmark(serverConnection(), Ip::Qos::dirOpened);
1517 // needs a bit of rework in ACLFilledChecklist to use Comm::Connection instead of ConnStateData
Definition: Stopwatch.h:18
AsyncCall::Pointer comm_add_close_handler(int fd, CLCB *handler, void *data)
Definition: comm.cc:952
bool tunneled
whether we spliced the connections instead of negotiating encryption
Definition: EncryptorAnswer.h:33
Definition: FilledChecklist.h:33
Comm::ConnectionPointer serverConn
a successfully opened connection to a server.
Definition: FwdState.h:237
void unregisterAbortCallback(const char *reason)
Definition: store.cc:1489
void reactToZeroSizeObject()
ERR_ZERO_SIZE_OBJECT requires special adjustments.
Definition: FwdState.cc:476
struct SquidConfig::@98 accessList
int setSockNfmark(const Comm::ConnectionPointer &conn, nfmark_t mark)
Definition: QosConfig.cc:589
bool destinationsFinalized
whether all of the available candidate paths received from DNS
Definition: ResolvedPeers.h:82
void errorAppendEntry(StoreEntry *entry, ErrorState *err)
Definition: errorpage.cc:738
Definition: pconn.h:113
Definition: EncryptorAnswer.h:21
void addPath(const Comm::ConnectionPointer &)
add a candidate path to try after all the existing paths
Definition: ResolvedPeers.cc:48
Definition: HttpTunnelerAnswer.h:29
void syncWithServerConn(const Comm::ConnectionPointer &server, const char *host, const bool reused)
commits to using the given open to-peer connection
Definition: FwdState.cc:1065
void updateError(const Error &)
sets (or updates the already stored) transaction error as needed
Definition: AccessLogEntry.cc:198
void secureConnectionToPeerIfNeeded(const Comm::ConnectionPointer &)
handles an established TCP connection to peer (including origin servers)
Definition: FwdState.cc:967
void error(char *format,...)
void startSelectingDestinations(HttpRequest *request, const AccessLogEntry::Pointer &ale, StoreEntry *entry)
Definition: peer_select.cc:330
void getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde)
Definition: QosConfig.cc:47
int tproxy_uses_indirect_client
Definition: SquidConfig.h:330
struct FwdState::@59 flags
void internalStart(const Comm::ConnectionPointer &clientConn, HttpRequest *request, StoreEntry *entry, const AccessLogEntry::Pointer &ale)
Definition: internal.cc:32
JobWait< HappyConnOpener > transportWait
waits for a transport connection to the peer to be established/opened
Definition: FwdState.h:224
time_t connectingTimeout(const Comm::ConnectionPointer &conn) const
Definition: FwdState.cc:1444
PconnPool * fwdPconnPool
a collection of previously used persistent Squid-to-peer HTTP(S) connections
Definition: FwdState.cc:78
void advanceDestination(const char *stepDescription, const Comm::ConnectionPointer &conn, const StepStart &startStep)
starts a preparation step for an established connection; retries on failures
Definition: FwdState.cc:820
struct SquidConfig::@97 onoff
void detailError(const ErrorDetail::Pointer &dCode)
set error type-specific detail code
Definition: errorpage.h:111
AccessLogEntry::Pointer al
info for the future access.log, and external ACL
Definition: FilledChecklist.h:124
void usePinned()
send request on an existing connection dedicated to the requesting client
Definition: FwdState.cc:1149
void syncHierNote(const Comm::ConnectionPointer &server, const char *host)
Definition: FwdState.cc:1085
void tunnelEstablishmentDone(Http::TunnelerAnswer &answer)
resumes operations after the (possibly failed) HTTP CONNECT exchange
Definition: FwdState.cc:929
Definition: Connection.h:72
A PeerConnector for HTTP origin servers. Capable of SslBumping.
Definition: PeekingPeerConnector.h:20
Definition: HttpTunneler.h:32
acl_access * serverPconnForNonretriable
Definition: SquidConfig.h:405
Definition: Checklist.h:30
static void Start(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *, const AccessLogEntryPointer &alp)
Initiates request forwarding to a peer or origin server.
Definition: FwdState.cc:338
static time_t diffOrZero(const time_t larger, const time_t smaller)
Definition: FwdState.cc:416
RefCount< AsyncCallT< Dialer > > asyncCall(int aDebugSection, int aDebugLevel, const char *aName, const Dialer &aDialer)
Definition: AsyncCall.h:156
static void RegisterWithCacheManager(void)
Definition: FwdState.cc:1396
void syncAle(HttpRequest *adaptedRequest, const char *logUri) const override
assigns uninitialized adapted_request and url ALE components
Definition: FilledChecklist.cc:110
static void HandleStoreAbort(FwdState *)
called by Store if the entry is no longer usable
Definition: FwdState.cc:83
void getOutgoingAddress(HttpRequest *request, const Comm::ConnectionPointer &conn)
Definition: FwdState.cc:1481
err_type FindDenyInfoPage(const Acl::Answer &answer, const bool redirect_allowed)
Definition: Gadgets.cc:34
void noteDestination(Comm::ConnectionPointer conn) override
called when a new unique destination has been found
Definition: FwdState.cc:587
Definition: PeerConnector.h:48
void stopAndDestroy(const char *reason)
ends forwarding; relies on refcounting so the effect may not be immediate
Definition: FwdState.cc:184
void closeServerConnection(const char *reason)
stops monitoring server connection for closure and updates pconn stats
Definition: FwdState.cc:108
UnaryCbdataDialer< Argument1 > cbdataDialer(typename UnaryCbdataDialer< Argument1 >::Handler *handler, Argument1 *arg1)
Definition: AsyncCbdataCalls.h:40
Definition: HttpRequest.h:48
bool exhaustedTries() const
whether we have used up all permitted forwarding attempts
Definition: FwdState.cc:1416
parameters for the async notePinnedConnectionBecameIdle() call
Definition: client_side.h:182
time_t connectTimeout(const time_t fwdStart) const
Definition: Connection.cc:161
static nfmark_t GetNfmarkToServer(HttpRequest *request, Comm::Connection &conn)
Definition: FwdState.cc:1547
void ResetMarkingsToServer(HttpRequest *request, Comm::Connection &conn)
Definition: FwdState.cc:1569
Http::StatusCode status() const
retrieve the status code for this status line
Definition: StatusLine.h:45
void updateAleWithFinalError()
updates ALE when we finalize the transaction error (if any)
Definition: FwdState.cc:241
const Comm::ConnectionPointer & serverConnection() const
Definition: FwdState.h:138
Definition: client_side.h:79
bool subscribed
whether noteDestination() and noteDestinationsEnd() calls are allowed
Definition: PeerSelectState.h:46
void successfullyConnectedToPeer(const Comm::ConnectionPointer &)
called when all negotiations with the peer have been completed
Definition: FwdState.cc:1050
void httpsPeeked(PinnedIdleContext pic)
called by FwdState when it is done bumping the server
Definition: client_side.cc:3071
void updateAttempts(int)
sets n_tries to the given value (while keeping ALE, if any, in sync)
Definition: FwdState.cc:1095
Definition: QosConfig.h:46
void establishTunnelThruProxy(const Comm::ConnectionPointer &)
Definition: FwdState.cc:908
JobWait< Security::PeerConnector > encryptionWait
waits for the established transport connection to be secured/encrypted
Definition: FwdState.h:227
#define CallJobHere(debugSection, debugLevel, job, Class, method)
Definition: AsyncJobCalls.h:59
bool waitingForDispatched
whether we are waiting for the last dispatch()ed activity to end
Definition: FwdState.h:234
Comm::ConnectionPointer clientConn
a possibly open connection to the client.
Definition: FwdState.h:212
void noteDestinationsEnd(ErrorState *selectionError) override
Definition: FwdState.cc:616
FwdState(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *, const AccessLogEntryPointer &alp)
Definition: FwdState.cc:120
Definition: HappyConnOpener.h:105
static tos_t GetTosToServer(HttpRequest *request, Comm::Connection &conn)
Definition: FwdState.cc:1534
class AccessLogEntry::CacheDetails cache
static bool EnoughTimeToReForward(const time_t fwdStart)
Definition: FwdState.cc:431
std::ostream & CurrentException(std::ostream &os)
prints active (i.e., thrown but not yet handled) exception
Definition: TextException.cc:88
static time_t ForwardTimeout(const time_t fwdStart)
time left to finish the whole forwarding process (which started at fwdStart)
Definition: FwdState.cc:423
Definition: FwdState.h:86
#define asyncCallback(dbgSection, dbgLevel, method, object)
Definition: AsyncCallbacks.h:195
static void logReplyStatus(int tries, const Http::StatusCode status)
Definition: FwdState.cc:1402
Definition: ResolvedPeers.h:33
void NoteOutgoingConnectionSuccess(CachePeer *const peer)
Definition: CachePeer.h:237
void completeSuccessfully(const char *whyWeAreSureWeStoredTheWholeReply)
Definition: store.cc:1017
bool notificationPending
whether HappyConnOpener::noteCandidatesChange() is scheduled to fire
Definition: ResolvedPeers.h:85
Final result (an open connection or an error) sent to the job initiator.
Definition: HappyConnOpener.h:75
A PeerConnector for TLS cache_peers and origin servers. No SslBump capabilities.
Definition: BlindPeerConnector.h:21
virtual void notePeerConnection(Comm::ConnectionPointer)
called just before a FwdState-dispatched job starts using connection
Definition: client_side.h:207
void urnStart(HttpRequest *r, StoreEntry *e, const AccessLogEntryPointer &ale)
Definition: urn.cc:204
void start(const JobPointer &aJob, const AsyncCall::Pointer &aCallback)
starts waiting for the given job to call the given callback
Definition: JobWait.h:69
tos_t aclMapTOS(acl_tos *head, ACLChecklist *ch)
Checks for a TOS value to apply depending on the ACL.
Definition: FwdState.cc:1458
static Comm::ConnectionPointer BorrowPinnedConnection(HttpRequest *, const AccessLogEntryPointer &)
Definition: client_side.cc:3868
Definition: QosConfig.h:32
Definition: Store.h:37
nfmark_t getNfConnmark(const Comm::ConnectionPointer &conn, const ConnectionDirection connDir)
Definition: QosConfig.cc:150
void prepForPeering(const CachePeer &peer)
get ready to be sent to the given cache_peer, including originserver
Definition: HttpRequest.cc:446
void reinstatePath(const PeerConnectionPointer &)
Definition: ResolvedPeers.cc:25
struct SquidConfig::@84 Timeout
static LogTagsErrors FromErrno(int errNo)
constructs an object matching errno(3) of a failed I/O call
Definition: LogTags.cc:22
void connectedToPeer(Security::EncryptorAnswer &answer)
called when all negotiations with the TLS-speaking peer have been completed
Definition: FwdState.cc:1014
static int FwdReplyCodes[MAX_FWD_STATS_IDX+1][Http::scInvalidHeader+1]
Definition: FwdState.cc:76
void RegisterAction(char const *action, char const *desc, OBJH *handler, Protected, Atomic, Format)
Definition: Registration.cc:54
PeeringActivityTimer peeringTimer
Measures time spent on selecting and communicating with peers.
Definition: FwdState.h:251
Ip::NfMarkConfig aclFindNfMarkConfig(acl_nfmark *head, ACLChecklist *ch)
Checks for a netfilter mark value to apply depending on the ACL.
Definition: FwdState.cc:1470
SBuf leftovers
peer-generated bytes after a positive answer (or empty)
Definition: HttpTunnelerAnswer.h:42
struct CachePeer::@27 options
void resetPeerNotes(const Comm::ConnectionPointer &server, const char *requestedHost)
Definition: access_log.cc:193
Definition: CommCalls.h:127
int setSockTos(const Comm::ConnectionPointer &conn, tos_t tos)
Definition: QosConfig.cc:557
void secureConnectionToPeer(const Comm::ConnectionPointer &)
encrypts an established TCP connection to peer (including origin servers)
Definition: FwdState.cc:996
static void fwdStart(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *)
Same as Start() but no master xaction info (AccessLogEntry) available.
Definition: FwdState.cc:407
bool encryptTransport
whether transport encryption (TLS/SSL) is to be used on connections to the peer
Definition: PeerOptions.h:147
Definition: errorpage.h:88
void prepForDirect()
get ready to be sent directly to an origin server, excluding originserver
Definition: HttpRequest.cc:456
bool IsReforwardableStatus(StatusCode)
whether to send the request to another peer based on the current response status code
Definition: StatusCode.cc:281
Stopwatch totalPeeringTime
cumulative time spent (so far) communicating with all peers (see %<tt)
Definition: HierarchyLogEntry.h:63
void markStoredReplyAsWhole(const char *whyWeAreSure)
Definition: FwdState.cc:575
void registerAbortCallback(const AsyncCall::Pointer &)
notify the StoreEntry writer of a 3rd-party initiated StoreEntry abort
Definition: store.cc:1481
bool noteFwdPconnUse
hack: whether the connection requires fwdPconnPool->noteUses()
Definition: PeerConnector.h:62
void closePendingConnection(const Comm::ConnectionPointer &conn, const char *reason)
get rid of a to-server connection that failed to become serverConn
Definition: FwdState.cc:96
bool checkRetriable()
Whether we may try sending this request again after a failure.
Definition: FwdState.cc:735
void completeTruncated(const char *whyWeConsiderTheReplyTruncated)
Definition: store.cc:1024
void comm_remove_close_handler(int fd, CLCB *handler, void *data)
Definition: comm.cc:981
CbcPointer< ConnStateData > clientConnectionManager
Definition: HttpRequest.h:232
bool ftpNative
carries a representation of an FTP command [received on ftp_port]
Definition: RequestFlags.h:112
void GetMarkingsToServer(HttpRequest *request, Comm::Connection &conn)
Definition: FwdState.cc:1560
ErrorDetail::Pointer MakeNamedErrorDetail(const char *name)
Definition: Detail.cc:54
void notifyConnOpener()
makes sure connection opener knows that the destinations have changed
Definition: FwdState.cc:661
#define CallJobHere1(debugSection, debugLevel, job, Class, method, arg1)
Definition: AsyncJobCalls.h:64
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products