client_side.h
Go to the documentation of this file.
185 PinnedIdleContext(const Comm::ConnectionPointer &conn, const HttpRequest::Pointer &req): connection(conn), request(req) {}
195 void pinBusyConnection(const Comm::ConnectionPointer &pinServerConn, const HttpRequest::Pointer &request);
201 static Comm::ConnectionPointer BorrowPinnedConnection(HttpRequest *, const AccessLogEntryPointer &);
215 ServerConnectionContext(const Comm::ConnectionPointer &conn, const SBuf &post101Bytes) : preReadServerBytes(post101Bytes), conn_(conn) { conn_->enterOrphanage(); }
337 bool initiateTunneledRequest(HttpRequest::Pointer const &cause, const char *reason, const SBuf &payload);
344 ClientHttpRequest *buildFakeRequest(SBuf &useHost, AnyP::KnownPort usePort, const SBuf &payload);
360 const ProxyProtocol::HeaderPointer &proxyProtocolHeader() const { return proxyProtocolHeader_; }
458 Security::ContextPointer getTlsContextFromCache(const SBuf &cacheKey, const Ssl::CertificateProperties &certProperties);
513void clientStartListeningOn(AnyP::PortCfgPointer &port, const RefCount< CommCbFunPtrCallT<CommAcceptCbPtrFun> > &subCall, const Ipc::FdNoteId noteId);
523void clientPackRangeHdr(const HttpReplyPointer &, const HttpHdrRangeSpec *, String boundary, MemBuf *);
void error(char *format,...)
Definition: FilledChecklist.h:32
an interface for those capable of configuring an ACLFilledChecklist object
Definition: ChecklistFiller.h:19
Definition: CachePeer.h:31
Definition: client_side_request.h:38
Definition: CommCalls.h:281
Definition: CommCalls.h:128
Definition: CommCalls.h:114
Definition: CommCalls.h:134
void leaveOrphanage()
resume relying on owner(s) to initiate an explicit connection closure
Definition: Connection.h:92
void enterOrphanage()
close the still-open connection when its last reference is gone
Definition: Connection.h:90
parameters for the async notePinnedConnectionBecameIdle() call
Definition: client_side.h:183
PinnedIdleContext(const Comm::ConnectionPointer &conn, const HttpRequest::Pointer &req)
Definition: client_side.h:185
HttpRequest::Pointer request
to-server request that initiated serverConnection
Definition: client_side.h:188
noteTakeServerConnectionControl() callback parameter
Definition: client_side.h:213
Comm::ConnectionPointer connection()
gives to-server connection to the new owner
Definition: client_side.h:218
ServerConnectionContext(const Comm::ConnectionPointer &conn, const SBuf &post101Bytes)
Definition: client_side.h:215
friend std::ostream & operator<<(std::ostream &, const ServerConnectionContext &)
Definition: client_side.cc:4056
Definition: client_side.h:84
virtual int pipelinePrefetchMax() const
returning N allows a pipeline of 1+N requests (see pipeline_prefetch)
Definition: client_side.cc:1736
void postHttpsAccept()
the second part of old httpsAccept, waiting for future HttpsServer home
Definition: client_side.cc:2494
bool fakeAConnectRequest(const char *reason, const SBuf &payload)
Definition: client_side.cc:3165
virtual void noteTakeServerConnectionControl(ServerConnectionContext)
Definition: client_side.h:229
virtual void clientPinnedConnectionClosed(const CommCloseCbParams &io)
Our close handler called by Comm when the pinned connection is closed.
Definition: client_side.cc:3697
char * prepareTlsSwitchingURL(const Http1::RequestParserPointer &hp)
Definition: client_side.cc:1220
Security::KeyLogger keyLogger
managers logging of the being-accepted TLS connection secrets
Definition: client_side.h:384
void afterClientRead() override
processing to be done after a Comm::Read()
Definition: client_side.cc:1930
Ssl::ServerBump * sslServerBump
HTTPS server cert. fetching state for bump-ssl-server-first.
Definition: client_side.h:494
const ProxyProtocol::HeaderPointer & proxyProtocolHeader() const
Definition: client_side.h:360
Http::Stream * parseHttpRequest(const Http1::RequestParserPointer &)
Definition: client_side.cc:1279
virtual bool writeControlMsgAndCall(HttpReply *rep, AsyncCall::Pointer &call)=0
handle a control message received by context from a peer and call back
Comm::ConnectionPointer serverConnection
Definition: client_side.h:143
void switchToHttps(ClientHttpRequest *, Ssl::BumpMode bumpServerMode)
Definition: client_side.cc:2801
void startPinnedConnectionMonitoring()
Definition: client_side.cc:3781
const char * stoppedReceiving() const
true if we stopped receiving the request
Definition: client_side.h:159
void consumeInput(const size_t byteCount)
remove no longer needed leading bytes from the input buffer
Definition: client_side.cc:1433
void clientAfterReadingRequests()
Definition: client_side.cc:1441
ClientHttpRequest * buildFakeRequest(SBuf &useHost, AnyP::KnownPort usePort, const SBuf &payload)
build a fake http request
Definition: client_side.cc:3194
virtual void handleReply(HttpReply *header, StoreIOBuffer receivedData)=0
void setAuth(const Auth::UserRequest::Pointer &aur, const char *cause)
Definition: client_side.cc:518
virtual Http::Stream * parseOneRequest()=0
void sendControlMsg(HttpControlMsg) override
called to send the 1xx message and notify the Source
Definition: client_side.cc:3651
const Auth::UserRequest::Pointer & getAuth() const
Definition: client_side.h:123
void getSslContextStart()
Start to create dynamic Security::ContextPointer for host or uses static port SSL context.
Definition: client_side.cc:2704
void httpsPeeked(PinnedIdleContext pic)
called by FwdState when it is done bumping the server
Definition: client_side.cc:3100
bool initiateTunneledRequest(HttpRequest::Pointer const &cause, const char *reason, const SBuf &payload)
generates and sends to tunnel.cc a fake request with a given payload
Definition: client_side.cc:3118
bool splice()
Splice a bumped client connection on peek-and-splice mode.
Definition: client_side.cc:2959
SBuf tlsClientSni_
TLS client delivered SNI value. Empty string if none has been received.
Definition: client_side.h:490
Error bareError
a problem that occurred without a request (e.g., while parsing headers)
Definition: client_side.h:381
void expectNoForwarding()
cleans up virgin request [body] forwarding state
Definition: client_side.cc:3608
Http::Stream * abortRequestParsing(const char *const errUri)
stop parsing the request and create context for relaying error info
Definition: client_side.cc:1022
void sslCrtdHandleReply(const Helper::Reply &reply)
Process response from ssl_crtd.
Definition: client_side.cc:2557
err_type handleChunkedRequestBody()
parses available chunked encoded body bytes, checks size, returns errors
Definition: client_side.cc:2013
void resetSslCommonName(const char *name)
Definition: client_side.h:293
void afterClientWrite(size_t) override
processing to sync state after a Comm::Write()
Definition: client_side.cc:1007
void terminateAll(const Error &, const LogTagsErrors &) override
abort any pending transactions and prevent new ones (by closing)
Definition: client_side.cc:3948
void abortChunkedRequestBody(const err_type error)
quit on errors related to chunked request body handling
Definition: client_side.cc:2054
void pinConnection(const Comm::ConnectionPointer &pinServerConn, const HttpRequest &request)
Forward future client requests using the given server connection.
Definition: client_side.cc:3736
bool preservingClientData_
whether preservedClientData is valid and should be kept up to date
Definition: client_side.h:434
void callException(const std::exception &) override
called when the job throws during an async call
Definition: client_side.cc:639
static void sslCrtdHandleReplyWrapper(void *data, const Helper::Reply &reply)
Callback function. It is called when squid receive message from ssl_crtd.
Definition: client_side.cc:2550
void lifetimeTimeout(const CommTimeoutCbParams ¶ms)
Definition: client_side.cc:2121
Security::ContextPointer getTlsContextFromCache(const SBuf &cacheKey, const Ssl::CertificateProperties &certProperties)
Definition: client_side.cc:2676
AnyP::Port tlsConnectPort
The TLS server port number as passed in the CONNECT request.
Definition: client_side.h:486
Auth::UserRequest::Pointer auth_
some user details that can be used to perform authentication on this connection
Definition: client_side.h:474
Comm::ConnectionPointer borrowPinnedConnection(HttpRequest *, const AccessLogEntryPointer &)
ConnStateData-specific part of BorrowPinnedConnection()
Definition: client_side.cc:3874
bool shouldPreserveClientData() const
Definition: client_side.cc:4010
void notePinnedConnectionBecameIdle(PinnedIdleContext pic)
Called when a pinned connection becomes available for forwarding the next request.
Definition: client_side.cc:3721
void stopPinnedConnectionMonitoring()
The caller assumes responsibility for connection closure detection.
Definition: client_side.cc:3793
void pinBusyConnection(const Comm::ConnectionPointer &pinServerConn, const HttpRequest::Pointer &request)
Definition: client_side.cc:3715
bool handleIdleClientPinnedTlsRead()
Definition: client_side.cc:3803
bool proxyProtocolError(const char *reason)
Definition: client_side.cc:1798
bool serveDelayedError(Http::Stream *)
Definition: client_side.cc:1467
struct ConnStateData::@37 pinning
const char * stoppedSending_
the reason why we no longer write the response or nil
Definition: client_side.h:499
void resetReadTimeout(time_t timeout)
(re)sets timeout for receiving more bytes from the client
Definition: client_side.cc:598
void quitAfterError(HttpRequest *request)
Definition: client_side.cc:1455
void updateError(const err_type c, const ErrorDetailPointer &d)
emplacement/convenience wrapper for updateError(const Error &)
Definition: client_side.h:366
SBuf tlsConnectHostOrIp
The TLS server host name appears in CONNECT request or the server ip address for the intercepted requ...
Definition: client_side.h:485
struct ConnStateData::@36 flags
void receivedFirstByte() override
Update flags and timeout after the first byte received.
Definition: client_side.cc:1844
uint64_t parsedBumpedRequestCount
The number of parsed HTTP requests headers on a bumped client connection.
Definition: client_side.h:481
BodyPipe::Pointer expectRequestBody(int64_t size)
Definition: client_side.cc:3559
void clientPinnedConnectionRead(const CommIoCbParams &io)
Definition: client_side.cc:3845
static Comm::ConnectionPointer BorrowPinnedConnection(HttpRequest *, const AccessLogEntryPointer &)
Definition: client_side.cc:3905
void stopReceiving(const char *error)
note request receiving error and close as soon as we write the response
Definition: client_side.cc:3588
void checkLogging()
log the last (attempt at) transaction if nobody else did
Definition: client_side.cc:3991
void unpinConnection(const bool andClose)
Undo pinConnection() and, optionally, close the pinned connection.
Definition: client_side.cc:3917
void handleSslBumpHandshakeError(const Security::IoResult &)
process a problematic Security::Accept() result on the SslBump code path
Definition: client_side.cc:3049
void startPeekAndSplice()
Initializes and starts a peek-and-splice negotiation with the SSL client.
Definition: client_side.cc:2993
bool concurrentRequestQueueFilled() const
Definition: client_side.cc:1750
ConnStateData(const MasterXactionPointer &xact)
Definition: client_side.cc:2131
ProxyProtocol::HeaderPointer proxyProtocolHeader_
the parsed PROXY protocol header
Definition: client_side.h:470
bool shouldCloseOnEof() const override
whether to stop serving our client after reading EOF on its connection
Definition: client_side.cc:1413
void fillChecklist(ACLFilledChecklist &) const override
configure the given checklist (to reflect the current transaction state)
Definition: client_side.cc:3515
void requestTimeout(const CommTimeoutCbParams ¶ms)
Definition: client_side.cc:2098
virtual void notePeerConnection(Comm::ConnectionPointer)
called just before a FwdState-dispatched job starts using connection
Definition: client_side.h:207
void noteMoreBodySpaceAvailable(BodyPipe::Pointer) override=0
virtual time_t idleTimeout() const =0
timeout to use when waiting for the next request
void clientReadFtpData(const CommIoCbParams &io)
void finishDechunkingRequest(bool withSuccess)
put parsed content into input buffer and clean up
Definition: client_side.cc:3628
virtual void processParsedRequest(Http::StreamPointer &)=0
start processing a freshly parsed request
void getSslContextDone(Security::ContextPointer &)
finish configuring the newly created SSL context"
Definition: client_side.cc:2764
bool parseProxyProtocolHeader()
Definition: client_side.cc:1819
AnyP::Port port
destination port of the request that caused serverConnection
Definition: client_side.h:145
void updateError(const Error &)
if necessary, stores new error information (if any)
Definition: client_side.cc:652
const char * stoppedReceiving_
the reason why we no longer read the request or nil
Definition: client_side.h:501
bool needProxyProtocolHeader_
whether PROXY protocol header is still expected
Definition: client_side.h:467
void noteBodyConsumerAborted(BodyPipe::Pointer) override=0
Definition: client_side.cc:2087
bool tunnelOnError(const err_type)
initiate tunneling if possible or return false otherwise
Definition: client_side.cc:1541
void stopSending(const char *error)
note response sending error and close as soon as we read the request
Definition: client_side.cc:983
int64_t mayNeedToReadMoreBody() const
Definition: client_side.cc:3570
void storeTlsContextToCache(const SBuf &cacheKey, Security::ContextPointer &ctx)
Definition: client_side.cc:2694
const char * stoppedSending() const
true if we stopped sending the response
Definition: client_side.h:161
Http1::TeChunkedParser * bodyParser
parses HTTP/1.1 chunked request body
Definition: client_side.h:108
void fillConnectionLevelDetails(ACLFilledChecklist &) const
Definition: client_side.cc:3532
AsyncCall::Pointer closeHandler
The close handler for pinned server side connection.
Definition: client_side.h:153
void connStateClosed(const CommCloseCbParams &io)
Definition: client_side.cc:507
bool proxyProtocolValidateClient()
Definition: client_side.cc:1779
void add(const Http::StreamPointer &context)
registers a newly created stream
Definition: client_side.cc:1722
void setServerBump(Ssl::ServerBump *srvBump)
Definition: client_side.h:286
void buildSslCertGenerationParams(Ssl::CertificateProperties &certProperties)
Definition: client_side.cc:2600
Definition: Reply.h:30
bundles HTTP 1xx reply and the "successfully forwarded" callback
Definition: HttpControlMsg.h:47
Definition: HttpHeaderRange.h:27
Definition: HttpReply.h:25
Definition: HttpRequest.h:49
Definition: TeChunkedParser.h:52
Definition: Stream.h:73
A RegisteredRunner with lifetime determined by forces outside the Registry.
Definition: RunnersRegistry.h:107
Definition: Address.h:41
Definition: LogTags.h:18
Definition: MasterXaction.h:40
Definition: MemBuf.h:24
manages collecting and logging secrets of a TLS connection to tls_key_log
Definition: KeyLogger.h:24
Definition: Server.h:32
Definition: gadgets.h:229
Definition: ServerBump.h:34
Definition: Store.h:42
Definition: StoreIOBuffer.h:16
Definition: SquidString.h:26
void CSD(clientStreamNode *, ClientHttpRequest *)
client stream detach
Definition: clientStreamForward.h:33
void CSR(clientStreamNode *, ClientHttpRequest *)
client stream read
Definition: clientStreamForward.h:30
void CSCB(clientStreamNode *, ClientHttpRequest *, HttpReply *, StoreIOBuffer)
client stream read callback
Definition: clientStreamForward.h:27
clientStream_status_t CSS(clientStreamNode *, ClientHttpRequest *)
Definition: clientStreamForward.h:35
void clientProcessRequestFinished(ConnStateData *, const HttpRequest::Pointer &)
Definition: client_side.cc:1572
const char * findTrailingHTTPVersion(const char *uriAndHTTPVersion, const char *end=nullptr)
Definition: client_side.cc:1076
void clientPackRangeHdr(const HttpReplyPointer &, const HttpHdrRangeSpec *, String boundary, MemBuf *)
append a "part" HTTP header (as in a multi-part/range reply) to the buffer
Definition: client_side.cc:733
void clientStartListeningOn(AnyP::PortCfgPointer &port, const RefCount< CommCbFunPtrCallT< CommAcceptCbPtrFun > > &subCall, const Ipc::FdNoteId noteId)
accept requests to a given port and inform subCall about them
Definition: client_side.cc:3322
void clientSetKeepaliveFlag(ClientHttpRequest *http)
decide whether to expect multiple requests on the corresponding connection
Definition: client_side.cc:698
std::ostream & operator<<(std::ostream &os, const ConnStateData::PinnedIdleContext &pic)
Definition: client_side.cc:4050
void clientPostHttpsAccept(ConnStateData *)
void clientProcessRequest(ConnStateData *, const Http1::RequestParserPointer &, Http::Stream *)
Definition: client_side.cc:1588
void clientPackTermBound(String boundary, MemBuf *)
put terminating boundary for multiparts to the buffer
Definition: client_side.cc:726
int varyEvaluateMatch(StoreEntry *entry, HttpRequest *req)
Definition: client_side.cc:3422
uint16_t KnownPort
validated/supported port number; these values are never zero
Definition: UriScheme.h:23
FdNoteId
We cannot send char* FD notes to other processes. Pass int IDs and convert.
Definition: FdNotes.h:20
Definition: Xaction.cc:40