client_side.h
Go to the documentation of this file.
186 PinnedIdleContext(const Comm::ConnectionPointer &conn, const HttpRequest::Pointer &req): connection(conn), request(req) {}
196 void pinBusyConnection(const Comm::ConnectionPointer &pinServerConn, const HttpRequest::Pointer &request);
202 static Comm::ConnectionPointer BorrowPinnedConnection(HttpRequest *, const AccessLogEntryPointer &);
216 ServerConnectionContext(const Comm::ConnectionPointer &conn, const SBuf &post101Bytes) : preReadServerBytes(post101Bytes), conn_(conn) { conn_->enterOrphanage(); }
338 bool initiateTunneledRequest(HttpRequest::Pointer const &cause, const char *reason, const SBuf &payload);
345 ClientHttpRequest *buildFakeRequest(SBuf &useHost, unsigned short usePort, const SBuf &payload);
361 const ProxyProtocol::HeaderPointer &proxyProtocolHeader() const { return proxyProtocolHeader_; }
457 Security::ContextPointer getTlsContextFromCache(const SBuf &cacheKey, const Ssl::CertificateProperties &certProperties);
512 void clientStartListeningOn(AnyP::PortCfgPointer &port, const RefCount< CommCbFunPtrCallT<CommAcceptCbPtrFun> > &subCall, const Ipc::FdNoteId noteId);
522 void clientPackRangeHdr(const HttpReplyPointer &, const HttpHdrRangeSpec *, String boundary, MemBuf *);
534 void clientProcessRequest(ConnStateData *, const Http1::RequestParserPointer &, Http::Stream *);
std::ostream & operator<<(std::ostream &os, const ConnStateData::PinnedIdleContext &pic)
Definition: client_side.cc:4096
virtual void noteMoreBodySpaceAvailable(BodyPipe::Pointer)=0
bool shouldPreserveClientData() const
Definition: client_side.cc:4056
Comm::ConnectionPointer connection()
gives to-server connection to the new owner
Definition: client_side.h:219
virtual void noteBodyConsumerAborted(BodyPipe::Pointer)=0
Definition: client_side.cc:2120
Definition: TeChunkedParser.h:52
virtual void clientPinnedConnectionClosed(const CommCloseCbParams &io)
Our close handler called by Comm when the pinned connection is closed.
Definition: client_side.cc:3744
void clientAfterReadingRequests()
Definition: client_side.cc:1451
SBuf tlsClientSni_
TLS client delivered SNI value. Empty string if none has been received.
Definition: client_side.h:489
void pinConnection(const Comm::ConnectionPointer &pinServerConn, const HttpRequest &request)
Forward future client requests using the given server connection.
Definition: client_side.cc:3783
virtual void processParsedRequest(Http::StreamPointer &)=0
start processing a freshly parsed request
void fillConnectionLevelDetails(ACLFilledChecklist &) const
Definition: client_side.cc:3579
A RegisteredRunner with lifetime determined by forces outside the Registry.
Definition: RunnersRegistry.h:107
Definition: gadgets.h:213
Definition: FilledChecklist.h:33
void pinBusyConnection(const Comm::ConnectionPointer &pinServerConn, const HttpRequest::Pointer &request)
Definition: client_side.cc:3762
void stopPinnedConnectionMonitoring()
The caller assumes responsibility for connection closure detection.
Definition: client_side.cc:3840
void setServerBump(Ssl::ServerBump *srvBump)
Definition: client_side.h:287
void lifetimeTimeout(const CommTimeoutCbParams ¶ms)
Definition: client_side.cc:2154
const char * stoppedSending() const
true if we stopped sending the response
Definition: client_side.h:162
void enterOrphanage()
close the still-open connection when its last reference is gone
Definition: Connection.h:88
void getSslContextStart()
Start to create dynamic Security::ContextPointer for host or uses static port SSL context.
Definition: client_side.cc:2737
void setAuth(const Auth::UserRequest::Pointer &aur, const char *cause)
Definition: client_side.cc:506
void resetSslCommonName(const char *name)
Definition: client_side.h:294
Definition: HttpHeaderRange.h:27
const ProxyProtocol::HeaderPointer & proxyProtocolHeader() const
Definition: client_side.h:361
struct ConnStateData::@39 pinning
bool proxyProtocolError(const char *reason)
Definition: client_side.cc:1824
void sslCrtdHandleReply(const Helper::Reply &reply)
Process response from ssl_crtd.
Definition: client_side.cc:2590
void clientProcessRequest(ConnStateData *, const Http1::RequestParserPointer &, Http::Stream *)
Definition: client_side.cc:1599
PinnedIdleContext(const Comm::ConnectionPointer &conn, const HttpRequest::Pointer &req)
Definition: client_side.h:186
Comm::ConnectionPointer borrowPinnedConnection(HttpRequest *, const AccessLogEntryPointer &)
ConnStateData-specific part of BorrowPinnedConnection()
Definition: client_side.cc:3920
void error(char *format,...)
Definition: CachePeer.h:28
Comm::ConnectionPointer serverConnection
Definition: client_side.h:144
virtual void sendControlMsg(HttpControlMsg)
called to send the 1xx message and notify the Source
Definition: client_side.cc:3698
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:721
bool splice()
Splice a bumped client connection on peek-and-splice mode.
Definition: client_side.cc:2992
Definition: LogTags.h:18
const char * stoppedReceiving_
the reason why we no longer read the request or nil
Definition: client_side.h:500
int64_t mayNeedToReadMoreBody() const
Definition: client_side.cc:3617
Definition: Server.h:30
clientStream_status_t CSS(clientStreamNode *, ClientHttpRequest *)
Definition: clientStreamForward.h:35
virtual void terminateAll(const Error &, const LogTagsErrors &)
abort any pending transactions and prevent new ones (by closing)
Definition: client_side.cc:3994
Security::KeyLogger keyLogger
managers logging of the being-accepted TLS connection secrets
Definition: client_side.h:385
Http1::TeChunkedParser * bodyParser
parses HTTP/1.1 chunked request body
Definition: client_side.h:109
struct ConnStateData::@38 flags
void handleSslBumpHandshakeError(const Security::IoResult &)
process a problematic Security::Accept() result on the SslBump code path
Definition: client_side.cc:3082
virtual void fillChecklist(ACLFilledChecklist &) const
configure the given checklist (to reflect the current transaction state)
Definition: client_side.cc:3562
const char * findTrailingHTTPVersion(const char *uriAndHTTPVersion, const char *end=NULL)
Definition: client_side.cc:1080
virtual bool shouldCloseOnEof() const
whether to stop serving our client after reading EOF on its connection
Definition: client_side.cc:1423
virtual void afterClientRead()
processing to be done after a Comm::Read()
Definition: client_side.cc:1952
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:2583
Definition: CommCalls.h:311
unsigned short tlsConnectPort
The TLS server port number as passed in the CONNECT request.
Definition: client_side.h:485
void startPinnedConnectionMonitoring()
Definition: client_side.cc:3828
void finishDechunkingRequest(bool withSuccess)
put parsed content into input buffer and clean up
Definition: client_side.cc:3675
void stopReceiving(const char *error)
note request receiving error and close as soon as we write the response
Definition: client_side.cc:3635
Http::Stream * parseHttpRequest(const Http1::RequestParserPointer &)
Definition: client_side.cc:1287
void postHttpsAccept()
the second part of old httpsAccept, waiting for future HttpsServer home
Definition: client_side.cc:2527
Definition: HttpRequest.h:49
Ssl::ServerBump * sslServerBump
HTTPS server cert. fetching state for bump-ssl-server-first.
Definition: client_side.h:493
const char * stoppedSending_
the reason why we no longer write the response or nil
Definition: client_side.h:498
void connStateClosed(const CommCloseCbParams &io)
Definition: client_side.cc:495
virtual Http::Stream * parseOneRequest()=0
bool needProxyProtocolHeader_
whether PROXY protocol header is still expected
Definition: client_side.h:467
parameters for the async notePinnedConnectionBecameIdle() call
Definition: client_side.h:184
void leaveOrphanage()
resume relying on owner(s) to initiate an explicit connection closure
Definition: Connection.h:90
Definition: StoreIOBuffer.h:16
AsyncCall::Pointer closeHandler
The close handler for pinned server side connection.
Definition: client_side.h:154
void CSD(clientStreamNode *, ClientHttpRequest *)
client stream detach
Definition: clientStreamForward.h:33
virtual void handleReply(HttpReply *header, StoreIOBuffer receivedData)=0
void CSR(clientStreamNode *, ClientHttpRequest *)
client stream read
Definition: clientStreamForward.h:30
Definition: client_side_request.h:38
bundles HTTP 1xx reply and the "successfully forwarded" callback
Definition: HttpControlMsg.h:47
void updateError(const Error &)
if necessary, stores new error information (if any)
Definition: client_side.cc:640
virtual void receivedFirstByte()
Update flags and timeout after the first byte received.
Definition: client_side.cc:1870
Definition: client_side.h:84
Definition: MemBuf.h:24
Definition: CommCalls.h:119
ServerConnectionContext(const Comm::ConnectionPointer &conn, const SBuf &post101Bytes)
Definition: client_side.h:216
bool concurrentRequestQueueFilled() const
Definition: client_side.cc:1776
Definition: Xaction.cc:48
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:3151
void httpsPeeked(PinnedIdleContext pic)
called by FwdState when it is done bumping the server
Definition: client_side.cc:3133
bool preservingClientData_
whether preservedClientData is valid and should be kept up to date
Definition: client_side.h:435
void resetReadTimeout(time_t timeout)
(re)sets timeout for receiving more bytes from the client
Definition: client_side.cc:586
FdNoteId
We cannot send char* FD notes to other processes. Pass int IDs and convert.
Definition: FdNotes.h:20
void stopSending(const char *error)
note response sending error and close as soon as we read the request
Definition: client_side.cc:987
Definition: Reply.h:30
bool handleIdleClientPinnedTlsRead()
Definition: client_side.cc:3850
virtual int pipelinePrefetchMax() const
returning N allows a pipeline of 1+N requests (see pipeline_prefetch)
Definition: client_side.cc:1762
manages collecting and logging secrets of a TLS connection to tls_key_log
Definition: KeyLogger.h:24
int varyEvaluateMatch(StoreEntry *entry, HttpRequest *req)
Definition: client_side.cc:3469
SBuf tlsConnectHostOrIp
The TLS server host name appears in CONNECT request or the server ip address for the intercepted requ...
Definition: client_side.h:484
Http::Stream * abortRequestParsing(const char *const errUri)
stop parsing the request and create context for relaying error info
Definition: client_side.cc:1026
Definition: SquidString.h:26
BodyPipe::Pointer expectRequestBody(int64_t size)
Definition: client_side.cc:3606
void buildSslCertGenerationParams(Ssl::CertificateProperties &certProperties)
Definition: client_side.cc:2633
void updateError(const err_type c, const ErrorDetailPointer &d)
emplacement/convenience wrapper for updateError(const Error &)
Definition: client_side.h:367
void clientPackTermBound(String boundary, MemBuf *)
put terminating boundary for multiparts to the buffer
Definition: client_side.cc:714
void add(const Http::StreamPointer &context)
registers a newly created stream
Definition: client_side.cc:1748
bool proxyProtocolValidateClient()
Definition: client_side.cc:1805
void quitAfterError(HttpRequest *request)
Definition: client_side.cc:1465
virtual time_t idleTimeout() const =0
timeout to use when waiting for the next request
void consumeInput(const size_t byteCount)
remove no longer needed leading bytes from the input buffer
Definition: client_side.cc:1443
virtual void callException(const std::exception &)
called when the job throws during an async call
Definition: client_side.cc:627
ProxyProtocol::HeaderPointer proxyProtocolHeader_
the parsed PROXY protocol header
Definition: client_side.h:470
Definition: ServerBump.h:34
void notePinnedConnectionBecameIdle(PinnedIdleContext pic)
Called when a pinned connection becomes available for forwarding the next request.
Definition: client_side.cc:3768
virtual bool writeControlMsgAndCall(HttpReply *rep, AsyncCall::Pointer &call)=0
handle a control message received by context from a peer and call back
void clientPinnedConnectionRead(const CommIoCbParams &io)
Definition: client_side.cc:3891
virtual void notePeerConnection(Comm::ConnectionPointer)
called just before a FwdState-dispatched job starts using connection
Definition: client_side.h:208
uint64_t parsedBumpedRequestCount
The number of parsed HTTP requests headers on a bumped client connection.
Definition: client_side.h:481
void getSslContextDone(Security::ContextPointer &)
finish configuring the newly created SSL context"
Definition: client_side.cc:2797
void switchToHttps(ClientHttpRequest *, Ssl::BumpMode bumpServerMode)
Definition: client_side.cc:2834
void abortChunkedRequestBody(const err_type error)
quit on errors related to chunked request body handling
Definition: client_side.cc:2087
void expectNoForwarding()
cleans up virgin request [body] forwarding state
Definition: client_side.cc:3655
const Auth::UserRequest::Pointer & getAuth() const
Definition: client_side.h:124
bool tunnelOnError(const err_type)
initiate tunneling if possible or return false otherwise
Definition: client_side.cc:1552
Definition: HttpReply.h:25
static Comm::ConnectionPointer BorrowPinnedConnection(HttpRequest *, const AccessLogEntryPointer &)
Definition: client_side.cc:3951
err_type handleChunkedRequestBody()
parses available chunked encoded body bytes, checks size, returns errors
Definition: client_side.cc:2046
void startPeekAndSplice()
Initializes and starts a peek-and-splice negotiation with the SSL client.
Definition: client_side.cc:3026
friend std::ostream & operator<<(std::ostream &, const ServerConnectionContext &)
Definition: client_side.cc:4102
noteTakeServerConnectionControl() callback parameter
Definition: client_side.h:214
Definition: Store.h:42
Auth::UserRequest::Pointer auth_
some user details that can be used to perform authentication on this connection
Definition: client_side.h:474
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:3374
bool serveDelayedError(Http::Stream *)
Definition: client_side.cc:1477
void clientReadFtpData(const CommIoCbParams &io)
void clientSetKeepaliveFlag(ClientHttpRequest *http)
decide whether to expect multiple requests on the corresponding connection
Definition: client_side.cc:686
Error bareError
a problem that occurred without a request (e.g., while parsing headers)
Definition: client_side.h:382
void clientPostHttpsAccept(ConnStateData *)
Definition: Stream.h:70
ConnStateData(const MasterXactionPointer &xact)
Definition: client_side.cc:2164
Definition: CommCalls.h:139
const char * stoppedReceiving() const
true if we stopped receiving the request
Definition: client_side.h:160
Definition: CommCalls.h:133
void clientProcessRequestFinished(ConnStateData *, const HttpRequest::Pointer &)
Definition: client_side.cc:1583
void checkLogging()
log the last (attempt at) transaction if nobody else did
Definition: client_side.cc:4037
void storeTlsContextToCache(const SBuf &cacheKey, Security::ContextPointer &ctx)
Definition: client_side.cc:2727
bool fakeAConnectRequest(const char *reason, const SBuf &payload)
Definition: client_side.cc:3195
void CSCB(clientStreamNode *, ClientHttpRequest *, HttpReply *, StoreIOBuffer)
client stream read callback
Definition: clientStreamForward.h:27
Definition: Address.h:41
virtual void afterClientWrite(size_t)
processing to sync state after a Comm::Write()
Definition: client_side.cc:1011
virtual void noteTakeServerConnectionControl(ServerConnectionContext)
Definition: client_side.h:230
an interface for those capable of configuring an ACLFilledChecklist object
Definition: ChecklistFiller.h:19
void unpinConnection(const bool andClose)
Undo pinConnection() and, optionally, close the pinned connection.
Definition: client_side.cc:3963
HttpRequest::Pointer request
to-server request that initiated serverConnection
Definition: client_side.h:189
ClientHttpRequest * buildFakeRequest(SBuf &useHost, unsigned short usePort, const SBuf &payload)
build a fake http request
Definition: client_side.cc:3224
char * prepareTlsSwitchingURL(const Http1::RequestParserPointer &hp)
Definition: client_side.cc:1228
void requestTimeout(const CommTimeoutCbParams ¶ms)
Definition: client_side.cc:2131
Security::ContextPointer getTlsContextFromCache(const SBuf &cacheKey, const Ssl::CertificateProperties &certProperties)
Definition: client_side.cc:2709
bool parseProxyProtocolHeader()
Definition: client_side.cc:1845
Definition: MasterXaction.h:40