client_side.cc
Go to the documentation of this file.
158 typedef void (*Handler)(AnyP::PortCfgPointer &portCfg, const Ipc::FdNoteId note, const Subscription::Pointer &sub);
159 ListeningStartedDialer(Handler aHandler, AnyP::PortCfgPointer &aPortCfg, const Ipc::FdNoteId note, const Subscription::Pointer &aSub):
184static void clientListenerConnectionOpened(AnyP::PortCfgPointer &s, const Ipc::FdNoteId portTypeNote, const Subscription::Pointer &sub);
197static void ClientSocketContextPushDeferredIfNeeded(Http::StreamPointer deferredRequest, ConnStateData * conn);
411 al->cache.objectSize = loggingEntry()->contentLen(); // payload duplicate ?? with or without TE ?
419 al->http.clientReplySz.payloadData = out.size - out.headers_sz; // pretend its all un-encoded data for now.
531 debugs(33, 2, "WARNING: Ignoring duplicate connection-auth for " << clientConnection << " from " << by);
572 debugs(33, 2, "WARNING: Graceful closure on " << clientConnection << " due to connection-auth erase from " << by);
575 // XXX: need to test whether the connection re-auth challenge is sent. If not, how to trigger it from here.
576 // NP: the current situation seems to fix challenge loops in Safari without visible issues in others.
577 // we stop receiving more traffic but can leave the Job running to terminate after the error or challenge is delivered.
584 debugs(33, 2, "ERROR: Closing " << clientConnection << " due to change of connection-auth from " << by);
601 AsyncCall::Pointer callback = JobCallback(33, 5, TimeoutDialer, this, ConnStateData::requestTimeout);
609 AsyncCall::Pointer callback = JobCallback(5, 4, TimeoutDialer, this, ConnStateData::lifetimeTimeout);
676 debugs(33, DBG_IMPORTANT, "ERROR: Squid BUG: ConnStateData did not close " << clientConnection);
679 debugs(33, DBG_IMPORTANT, "ERROR: Squid BUG: ConnStateData was not destroyed properly; " << clientConnection);
733clientPackRangeHdr(const HttpReplyPointer &rep, const HttpHdrRangeSpec * spec, String boundary, MemBuf * mb)
784 debugs(33, 6, "clientMRangeCLen: (clen += " << mb.size << " + " << (*pos)->length << ") == " << clen);
828 if (!http->getConn() || !cbdataReferenceValid(http->getConn()) || !Comm::IsConnOpen(http->getConn()->clientConnection))
896ClientSocketContextPushDeferredIfNeeded(Http::StreamPointer deferredRequest, ConnStateData * conn)
926 debugs(33, 2, clientConnection << " Connection was pinned but server side gone. Terminating client connection");
1118 static const CharacterSet uriScheme = CharacterSet("URI-scheme","+-.") + CharacterSet::ALPHA + CharacterSet::DIGIT;
1169 snprintf(uri, url_sz, SQUIDSBUFPH "://" SQUIDSBUFPH SQUIDSBUFPH, SQUIDSBUFPRINT(scheme), SQUIDSBUFPRINT(host), SQUIDSBUFPRINT(url));
1173 debugs(33, 5, "ACCEL DEFAULTSITE REWRITE: defaultsite=" << conn->port->defaultsite << " + vport=" << vport);
1180 const int url_sz = scheme.length() + strlen(conn->port->defaultsite) + sizeof(vportStr) + url.length() + 32;
1281 /* Attempt to parse the first line; this will define where the method, url, version and header begin */
1320 debugs(33, DBG_IMPORTANT, "WARNING: CONNECT method received on " << transferProtocol << " Accelerator port " << port->s.port());
1321 debugs(33, DBG_IMPORTANT, "WARNING: for request: " << hp->method() << " " << hp->requestUri() << " " << hp->messageProtocol());
1331 debugs(33, DBG_IMPORTANT, "WARNING: PRI method received on " << transferProtocol << " port " << port->s.port());
1332 debugs(33, DBG_IMPORTANT, "WARNING: for request: " << hp->method() << " " << hp->requestUri() << " " << hp->messageProtocol());
1338 debugs(33, DBG_IMPORTANT, "WARNING: Unsupported method: " << hp->method() << " " << hp->requestUri() << " " << hp->messageProtocol());
1505 const auto sslErrors = std::make_unique<Security::CertErrors>(Security::CertError(SQUID_X509_V_ERR_DOMAIN_MISMATCH, srvCert));
1521 const auto err = new ErrorState(ERR_SECURE_CONNECT_FAIL, Http::scServiceUnavailable, request, http->al);
1580 if (request != nullptr && request->flags.resetTcp && Comm::IsConnOpen(conn->clientConnection)) {
1588clientProcessRequest(ConnStateData *conn, const Http1::RequestParserPointer &hp, Http::Stream *context)
1614 ((request->flags.sslBumped || conn->port->transport.protocol == AnyP::PROTO_HTTPS) ? Http::Message::srcHttps : Http::Message::srcHttp);
1654 repContext->setReplyToError(ERR_INVALID_REQ, frameStatus, nullptr, conn, request.getRaw(), nullptr, nullptr);
1765 debugs(33, 3, clientConnection << " max concurrent requests reached (" << concurrentRequestLimit << ")");
1832 debugs(33, 5, "PROXY/" << proxyProtocolHeader_->version() << " upgrade: " << clientConnection);
1923 debugs(33, 5, "monitoring half-closed while processing parsed requests: " << clientConnection);
2103 const err_type error = receivedFirstByte_ ? ERR_REQUEST_PARSE_TIMEOUT : ERR_REQUEST_START_TIMEOUT;
2159 debugs(33, 2, "WARNING: Path MTU discovery disabling failed on " << clientConnection << " : " << xstrerr(xerrno));
2165 debugs(33, DBG_IMPORTANT, "WARNING: Path MTU discovery disabling is not supported on your platform.");
2325 debugs(83, (handshakeResult.important ? Important(62) : 2), "ERROR: " << handshakeResult.errorDescription <<
2326 " while accepting a TLS connection on " << conn->clientConnection << ": " << handshakeResult.errorDetail);
2371 debugs(83, 4, "With " OPENSSL_VERSION_TEXT ", session details are available only defining ALLOW_ALWAYS_SSL_SESSION_DETAIL=1 in the source.");
2450 debugs(33, 2, "sslBump action " << Ssl::bumpMode(answer.kind) << "needed for " << connState->clientConnection);
2477 debugs(33, 2, "httpsAccept: " << params.port->listenConn << ": accept failure: " << xstrerr(params.xerrno));
2521 ACLFilledChecklist *acl_checklist = new ACLFilledChecklist(Config.accessList.ssl_bump, request, nullptr);
2560 debugs(33, 3, "Connection gone while waiting for ssl_crtd helper reply; helper reply:" << reply);
2565 debugs(33, 5, "Certificate for " << tlsConnectHostOrIp << " cannot be generated. ssl_crtd response: " << reply);
2570 if (reply_message.parse(reply.other().content(), reply.other().contentSize()) != Ssl::CrtdMessage::OK) {
2574 debugs(33, 5, "Certificate for " << tlsConnectHostOrIp << " cannot be generated. ssl_crtd response: " << reply_message.getBody());
2576 debugs(33, 5, "Certificate for " << tlsConnectHostOrIp << " was successfully received from ssl_crtd");
2577 if (sslServerBump && (sslServerBump->act.step1 == Ssl::bumpPeek || sslServerBump->act.step1 == Ssl::bumpStare)) {
2580 bool ret = Ssl::configureSSLUsingPkeyAndCertFromMemory(ssl, reply_message.getBody().c_str(), *port);
2587 Security::ContextPointer ctx(Ssl::GenerateSslContextUsingPkeyAndCertFromMemory(reply_message.getBody().c_str(), port->secure, (signAlgorithm == Ssl::algSignTrusted)));
2602 certProperties.commonName = sslCommonName_.isEmpty() ? tlsConnectHostOrIp.c_str() : sslCommonName_.c_str();
2676ConnStateData::getTlsContextFromCache(const SBuf &cacheKey, const Ssl::CertificateProperties &certProperties)
2679 Ssl::LocalContextStorage * ssl_ctx_cache = Ssl::TheGlobalContextStorage.getLocalStorage(port->s);
2685 debugs(33, 5, "Cached SSL certificate for " << certProperties.commonName << " is out of date. Delete this certificate from cache");
2696 Ssl::LocalContextStorage *ssl_ctx_cache = Ssl::TheGlobalContextStorage.getLocalStorage(port->s);
2711 if (!(sslServerBump && (sslServerBump->act.step1 == Ssl::bumpPeek || sslServerBump->act.step1 == Ssl::bumpStare))) {
2725 debugs(33, 5, "Generating SSL certificate for " << certProperties.commonName << " using ssl_crtd.");
2742 if (sslServerBump && (sslServerBump->act.step1 == Ssl::bumpPeek || sslServerBump->act.step1 == Ssl::bumpStare)) {
2751 Security::ContextPointer dynCtx(Ssl::GenerateSslContext(certProperties, port->secure, (signAlgorithm == Ssl::algSignTrusted)));
2773 debugs(83, DBG_IMPORTANT, "Closing " << clientConnection->remote << " as lacking TLS context");
2911 if (!sslServerBump || sslServerBump->act.step1 == Ssl::bumpClientFirst) { // Either means client-first.
2920 FwdState::Start(clientConnection, sslServerBump->entry, sslServerBump->request.getRaw(), http ? http->al : nullptr);
3004 ACLFilledChecklist *acl_checklist = new ACLFilledChecklist(Config.accessList.ssl_bump, sslServerBump->request.getRaw(), nullptr);
3014 Security::ContextPointer unConfiguredCTX(Ssl::createSSLContext(port->secure.signingCa.cert, port->secure.signingCa.pkey, port->secure));
3044 FwdState::Start(clientConnection, sslServerBump->entry, sslServerBump->request.getRaw(), http ? http->al : nullptr);
3073 debugs(83, (handshakeResult.important ? DBG_IMPORTANT : 2), "ERROR: " << handshakeResult.errorDescription <<
3074 " while SslBump-accepting a TLS connection on " << clientConnection << ": " << handshakeResult.errorDetail);
3092 debugs(33, 5, "PeekAndSplice mode, proceed with client negotiation. Current state:" << SSL_state_string_long(ssl));
3104 Must(pipeline.empty() || pipeline.front()->http == nullptr || pipeline.front()->http->request == pic.request.getRaw());
3118ConnStateData::initiateTunneledRequest(HttpRequest::Pointer const &cause, const char *reason, const SBuf &payload)
3194ConnStateData::buildFakeRequest(SBuf &useHost, const AnyP::KnownPort usePort, const SBuf &payload)
3231 request->sources |= ((switchedToHttps() || port->transport.protocol == AnyP::PROTO_HTTPS) ? Http::Message::srcHttps : Http::Message::srcHttp);
3289 debugs(33, DBG_IMPORTANT, "WARNING: No ssl_bump configured. Disabling ssl-bump on " << scheme << "_port " << s->s);
3293 debugs(1, DBG_IMPORTANT, "Will not bump SSL at " << scheme << "_port " << s->s << " due to TLS initialization failure.");
3306 debugs(1, DBG_CRITICAL, "ERROR: Ignoring " << scheme << "_port " << s->s << " due to TLS context initialization failure.");
3322clientStartListeningOn(AnyP::PortCfgPointer &port, const RefCount< CommCbFunPtrCallT<CommAcceptCbPtrFun> > &subCall, const Ipc::FdNoteId fdNote)
3350clientListenerConnectionOpened(AnyP::PortCfgPointer &s, const Ipc::FdNoteId portTypeNote, const Subscription::Pointer &sub)
3370 Must(AddOpenedHttpSocket(s->listenConn)); // otherwise, we have received a fd we did not ask for
3555 return clientConnection != nullptr && (clientConnection->flags & (COMM_TRANSPARENT|COMM_INTERCEPTION));
3671 AsyncCall::Pointer call = JobCallback(33, 5, Dialer, this, HttpControlMsgSink::wroteControlMsg);
3715ConnStateData::pinBusyConnection(const Comm::ConnectionPointer &pinServer, const HttpRequest::Pointer &request)
3736ConnStateData::pinConnection(const Comm::ConnectionPointer &pinServer, const HttpRequest &request)
3824 debugs(83, DBG_IMPORTANT, pinning.serverConnection << " TLS SSL_ERROR_WANT_WRITE request for idle pinned connection");
3943 /* NOTE: pinning.pinned should be kept. This combined with fd == -1 at the end of a request indicates that the host
4049std::ostream &
4055std::ostream &
void accessLogLog(const AccessLogEntryPointer &, ACLChecklist *)
Definition: access_log.cc:136
RefCount< AsyncCallT< Dialer > > asyncCall(int aDebugSection, int aDebugLevel, const char *aName, const Dialer &aDialer)
Definition: AsyncCall.h:156
#define JobCallback(dbgSection, dbgLevel, Dialer, job, method)
Convenience macro to create a Dialer-based job callback.
Definition: AsyncJobCalls.h:69
CommCbFunPtrCallT< Dialer > * commCbCall(int debugSection, int debugLevel, const char *callName, const Dialer &dialer)
Definition: CommCalls.h:312
ErrorDetail::Pointer MakeNamedErrorDetail(const char *name)
Definition: Detail.cc:54
void httpHeaderAddContRange(HttpHeader *, HttpHdrRangeSpec, int64_t)
Definition: HttpHeaderTools.cc:76
std::ostream & CurrentException(std::ostream &os)
prints active (i.e., thrown but not yet handled) exception
Definition: TextException.cc:88
@ tlsBump1
@ tlsBump2
@ tlsBump3
void error(char *format,...)
void banAction(const Acl::Answer &action)
add action to the list of banned actions
Definition: Checklist.cc:395
void nonBlockingCheck(ACLCB *callback, void *callback_data)
Definition: Checklist.cc:237
Definition: FilledChecklist.h:32
void setIdent(const char *userIdentity)
configure rfc931 user identity for the first time
Definition: FilledChecklist.cc:255
void setRequest(HttpRequest *)
configure client request-related fields for the first time
Definition: FilledChecklist.cc:236
CbcPointer< Security::CertErrors > sslErrors
Definition: FilledChecklist.h:94
AccessLogEntry::Pointer al
info for the future access.log, and external ACL
Definition: FilledChecklist.h:101
void syncAle(HttpRequest *adaptedRequest, const char *logUri) const override
assigns uninitialized adapted_request and url ALE components
Definition: FilledChecklist.cc:121
char * last_meta
image of the last ICAP response header or eCAP meta received
Definition: AccessLogEntry.h:187
MessageSizes clientRequestSz
counters for the original request received from client
Definition: AccessLogEntry.h:103
Definition: AccessLogEntry.h:41
class AccessLogEntry::CacheDetails cache
class AccessLogEntry::IcapLogEntry icap
class AccessLogEntry::Headers headers
Comm::ConnectionPointer tcpClient
TCP/IP level details about the client connection.
Definition: AccessLogEntry.h:83
class AccessLogEntry::HttpDetails http
class AccessLogEntry::AdaptationDetails adapt
class AccessLogEntry::IcpDetails icp
ProxyProtocol::HeaderPointer proxyProtocolHeader
see ConnStateData::proxyProtocolHeader_
Definition: AccessLogEntry.h:210
void updateError(const Error &)
sets (or updates the already stored) transaction error as needed
Definition: AccessLogEntry.cc:212
Definition: Acl.h:128
HttpHeader lastMeta
Last received meta header (REQMOD or RESPMOD, whichever comes last).
Definition: History.h:61
Definition: ProtocolVersion.h:24
Definition: UriScheme.h:32
void setScheme(const AnyP::ProtocolType &p, const char *str)
convert the URL scheme to that given
Definition: Uri.h:70
Definition: AsyncCall.h:41
a smart AsyncCall pointer for delivery of future results
Definition: AsyncCallbacks.h:32
Definition: AsyncJob.h:32
virtual void callException(const std::exception &e)
called when the job throws during an async call
Definition: AsyncJob.cc:143
Definition: BodyPipe.h:62
Definition: BodyPipe.h:91
void enableAutoConsumption()
start or continue consuming when producing without consumer
Definition: BodyPipe.cc:316
void stopProducingFor(RefCount< BodyPipe > &, bool atEof)
Definition: BodyPipe.cc:107
Definition: CachePeer.h:31
Definition: AsyncCall.h:107
Definition: Subscription.h:49
optimized set of C chars, with quick membership test and merge support
Definition: CharacterSet.h:18
std::vector< ClientDelayPool::Pointer > pools
Definition: ClientDelayConfig.h:47
Definition: client_side_request.h:38
struct ClientHttpRequest::Out out
void clearRequest()
resets the current request and log_uri to nil
Definition: client_side_request.cc:1682
void initRequest(HttpRequest *)
Definition: client_side_request.cc:1609
void checkForInternalAccess()
Checks whether the current request is internal and adjusts it accordingly.
Definition: client_side_request.cc:1648
void updateError(const Error &)
if necessary, stores new error information (if any)
Definition: client_side_request.cc:1568
size_t req_sz
raw request size on input, not current request size
Definition: client_side_request.h:162
struct ClientHttpRequest::Flags flags
bool multipartRangeRequest() const
Definition: client_side.cc:720
ClientRequestContext * calloutContext
Definition: client_side_request.h:179
const LogTags & loggingTags() const
the processing tags associated with this request transaction.
Definition: client_side_request.h:97
StoreEntry * loggingEntry() const
Definition: client_side_request.h:68
struct ClientHttpRequest::Redirect redirect
Definition: ClientInfo.h:34
void setWriteLimiter(const int aWriteSpeedLimit, const double anInitialBurst, const double aHighWatermark)
Definition: comm.cc:1376
Definition: ClientRequestContext.h:29
Definition: ClpMap.h:41
static void Reset()
forgets the current context, setting it to nil/unknown
Definition: CodeContext.cc:77
Definition: CommCalls.h:93
AnyP::PortCfgPointer port
the configuration listening port this call relates to (may be nil)
Definition: CommCalls.h:100
Definition: CommCalls.h:196
Definition: CommCalls.h:281
Definition: CommCalls.h:166
Definition: CommCalls.h:128
Definition: CommCalls.h:114
Definition: CommCalls.h:134
time_t timeLeft(const time_t idleTimeout) const
Definition: Connection.cc:146
Security::NegotiationHistory * tlsNegotiations()
Definition: Connection.cc:156
Definition: TcpAcceptor.h:39
parameters for the async notePinnedConnectionBecameIdle() call
Definition: client_side.h:183
HttpRequest::Pointer request
to-server request that initiated serverConnection
Definition: client_side.h:188
noteTakeServerConnectionControl() callback parameter
Definition: client_side.h:213
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 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
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
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
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 time_t idleTimeout() const =0
timeout to use when waiting for the next request
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
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 buildSslCertGenerationParams(Ssl::CertificateProperties &certProperties)
Definition: client_side.cc:2600
static bool Enabled(const int section, const int level)
whether debugging the given section and the given level produces output
Definition: Stream.h:75
Definition: errorpage.h:89
static ErrorState * NewForwarding(err_type, HttpRequestPointer &, const AccessLogEntryPointer &)
Creates a general request forwarding error with the right http_status.
Definition: errorpage.cc:674
void update(const Error &)
if necessary, stores the given error information (if any)
Definition: Error.cc:51
Definition: ExceptionErrorDetail.h:22
static void Start(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *, const AccessLogEntryPointer &alp)
Initiates request forwarding to a peer or origin server.
Definition: FwdState.cc:341
Definition: Reply.h:30
Definition: HierarchyLogEntry.h:23
AsyncCall::Pointer cbControlMsgSent
Call to schedule when the control msg has been sent.
Definition: HttpControlMsg.h:42
void wroteControlMsg(const CommIoCbParams &)
callback to handle Comm::Write completion
Definition: HttpControlMsg.cc:25
virtual void doneWithControlMsg()
Definition: HttpControlMsg.cc:15
bundles HTTP 1xx reply and the "successfully forwarded" callback
Definition: HttpControlMsg.h:47
Definition: HttpHeaderRange.h:27
std::vector< HttpHdrRangeSpec * >::iterator iterator
Definition: HttpHeaderRange.h:65
Definition: HttpHeader.h:75
void packInto(Packable *p, bool mask_sensitive_info=false) const
Definition: HttpHeader.cc:540
Definition: HttpReply.h:25
Definition: HttpRequest.h:49
SBuf vary_headers
The variant second-stage cache key. Generated from Vary header pattern for this request.
Definition: HttpRequest.h:170
Adaptation::History::Pointer adaptLogHistory() const
Returns possibly nil history, creating it if adapt. logging is enabled.
Definition: HttpRequest.cc:415
Auth::UserRequest::Pointer auth_user_request
Definition: HttpRequest.h:127
Http::StatusCode checkEntityFraming() const
Definition: HttpRequest.cc:647
Adaptation::Icap::History::Pointer icapHistory() const
Returns possibly nil history, creating it if icap logging is enabled.
Definition: HttpRequest.cc:389
void manager(const CbcPointer< ConnStateData > &aMgr, const AccessLogEntryPointer &al)
associates the request with a from-client connection manager
Definition: HttpRequest.cc:774
const SBuf & effectiveRequestUri() const
RFC 7230 section 5.5 - Effective Request URI.
Definition: HttpRequest.cc:744
Definition: TeChunkedParser.h:52
bool needsMoreSpace() const
Definition: TeChunkedParser.cc:82
void setPayloadBuffer(MemBuf *parsedContent)
set the buffer to be used to store decoded chunk data
Definition: TeChunkedParser.h:58
Definition: Stream.h:73
struct Http::Stream::@74 flags
clientStreamNode * getClientReplyContext() const
Definition: Stream.cc:510
char * toStr(char *buf, const unsigned int blen, int force=AF_UNSPEC) const
Definition: Address.cc:792
unsigned int toHostStr(char *buf, const unsigned int len) const
Definition: Address.cc:842
Subscription::Pointer sub
The handler to be subscribed for this connection listener.
Definition: client_side.cc:181
ListeningStartedDialer(Handler aHandler, AnyP::PortCfgPointer &aPortCfg, const Ipc::FdNoteId note, const Subscription::Pointer &aSub)
Definition: client_side.cc:159
void print(std::ostream &os) const override
Definition: client_side.cc:163
void(* Handler)(AnyP::PortCfgPointer &portCfg, const Ipc::FdNoteId note, const Subscription::Pointer &sub)
Definition: client_side.cc:158
virtual bool canDial(AsyncCall &) const
Definition: client_side.cc:167
Definition: LogTags.h:18
Definition: LogTags.h:67
LogTags_ot oldType
a set of client protocol, cache use, and other transaction outcome tags
Definition: LogTags.h:93
Comm::ConnectionPointer tcpClient
the client TCP connection which originated this transaction
Definition: MasterXaction.h:66
static Pointer MakePortful(const AnyP::PortCfgPointer &aPort)
Definition: MasterXaction.h:54
Definition: MemBuf.h:24
uint64_t payloadData
total size of payload block(s) excluding transfer encoding overheads
Definition: MessageSizes.h:24
Definition: Notes.h:173
void appendf(const char *fmt,...) PRINTF_FORMAT_ARG2
Append operation with printf-style arguments.
Definition: Packable.h:61
thrown by modern "incremental" parsers when they need more data
Definition: forward.h:18
Definition: Tokenizer.h:30
bool empty() const
whether there are none or any requests currently pipelined
Definition: Pipeline.h:56
Http::StreamPointer front() const
get the first request context in the pipeline
Definition: Pipeline.cc:28
void add(const Http::StreamPointer &)
register a new request context to the pipeline
Definition: Pipeline.cc:20
Http::StreamPointer back() const
get the last request context in the pipeline
Definition: Pipeline.cc:40
bool forceTunnel
whether to forward via TunnelStateData (instead of FwdState)
Definition: RequestFlags.h:120
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
Definition: SBuf.h:275
Definition: CertError.h:20
void checkpoint(const Connection &, const Acl::ChecklistFiller &)
Definition: KeyLogger.h:50
void retrieveParsedInfo(Security::TlsDetails::Pointer const &details)
Extract information from parser stored in TlsDetails object.
Definition: NegotiationHistory.cc:95
Definition: Server.h:32
bool receivedFirstByte_
true if at least one byte received on this connection
Definition: Server.h:115
struct SquidConfig::@107 accessList
struct SquidConfig::@106 onoff
struct SquidConfig::@101 Addrs
acl_access * on_unsupported_protocol
Definition: SquidConfig.h:400
struct SquidConfig::@116 ssl_client
struct SquidConfig::@93 Timeout
Definition: gadgets.h:229
Security::PrivateKeyPointer signWithPkey
The key of the signing certificate.
Definition: gadgets.h:234
Security::CertPointer signWithX509
Certificate to sign the generated request.
Definition: gadgets.h:233
bool setCommonName
Replace the CN field of the mimicking subject with the given.
Definition: gadgets.h:237
Definition: bio.h:71
Definition: crtd_message.h:25
void setCode(std::string const &aCode)
Set new request/reply code to compose.
Definition: crtd_message.cc:126
static const std::string code_new_certificate
String code for "new_certificate" messages.
Definition: crtd_message.h:76
std::string const & getBody() const
Current body. If parsing is not finished the method returns incompleted body.
Definition: crtd_message.cc:120
ParseResult parse(const char *buffer, size_t len)
Definition: crtd_message.cc:23
void composeRequest(Ssl::CertificateProperties const &)
Definition: crtd_message.cc:235
void addLocalStorage(Ip::Address const &address, size_t size_of_store)
Create new SSL context storage for the local listening address/port.
Definition: context_storage.cc:74
LocalContextStorage * getLocalStorage(Ip::Address const &address)
Return the local storage for the given listening address/port.
Definition: context_storage.cc:80
static void Submit(CrtdMessage const &message, HLPCB *callback, void *data)
Submit crtd message to external crtd server.
Definition: helper.cc:124
Definition: ServerBump.h:34
bool at(const BumpStep stp) const
whether we are currently performing the given processing step
Definition: ServerBump.h:47
Security::CertErrors * sslErrors() const
SSL [certificate validation] errors.
Definition: ServerBump.cc:66
HttpRequest::Pointer request
faked, minimal request; required by Client API
Definition: ServerBump.h:53
bool connectedOk() const
whether there was a successful connection to (and peeking at) the origin server
Definition: ServerBump.h:44
struct StatCounters::@128 cd
struct StatCounters::@129 netdb
struct StatCounters::@122 client_http
struct StatCounters::@124 icp
Definition: Store.h:42
Definition: StoreIOBuffer.h:16
Definition: SquidString.h:26
access to a callback result carried by an asynchronous CallDialer
Definition: AsyncCallbacks.h:19
Definition: client_side_reply.h:23
void setReplyToStoreEntry(StoreEntry *e, const char *reason)
replaces current response store entry with the given one
Definition: client_side_reply.cc:153
void setReplyToError(err_type, Http::StatusCode, char const *, const ConnStateData *, HttpRequest *, const char *, Auth::UserRequest::Pointer)
builds error using clientBuildError() and calls setReplyToError() below
Definition: client_side_reply.cc:95
Definition: clientStream.h:76
Definition: ProxyCerts.h:39
Definition: ProxyCerts.h:18
int clientdbEstablished(const Ip::Address &addr, int delta)
Definition: client_db.cc:182
void clientdbUpdate(const Ip::Address &addr, const LogTags <ype, AnyP::ProtocolType p, size_t size)
Definition: client_db.cc:138
static void clientListenerConnectionOpened(AnyP::PortCfgPointer &s, const Ipc::FdNoteId portTypeNote, const Subscription::Pointer &sub)
process clientHttpConnectionsOpen result
Definition: client_side.cc:3350
static void clientUpdateStatHistCounters(const LogTags &logType, int svc_time)
Definition: client_side.cc:225
static char * prepareTransparentURL(ConnStateData *conn, const Http1::RequestParserPointer &hp)
Definition: client_side.cc:1254
const char * findTrailingHTTPVersion(const char *uriAndHTTPVersion, const char *end)
Definition: client_side.cc:1076
static bool clientPingHasFinished(ping_data const *aPing)
Definition: client_side.cc:267
static void httpsEstablish(ConnStateData *connState, const Security::ContextPointer &ctx)
Definition: client_side.cc:2423
void prepareLogWithRequestDetails(HttpRequest *, const AccessLogEntryPointer &)
Definition: client_side.cc:335
void clientProcessRequestFinished(ConnStateData *conn, const HttpRequest::Pointer &request)
Definition: client_side.cc:1572
static void httpsSslBumpAccessCheckDone(Acl::Answer answer, void *data)
Definition: client_side.cc:2441
void clientProcessRequest(ConnStateData *conn, const Http1::RequestParserPointer &hp, Http::Stream *context)
Definition: client_side.cc:1588
static bool httpsCreate(const ConnStateData *connState, const Security::ContextPointer &ctx)
Create TLS connection structure and update fd_table.
Definition: client_side.cc:2292
static bool OpenedHttpSocket(const Comm::ConnectionPointer &c, const Ipc::FdNoteId portType)
check FD after clientHttp[s]ConnectionOpened, adjust HttpSockets as needed
Definition: client_side.cc:3245
static char * buildUrlFromHost(ConnStateData *conn, const Http1::RequestParserPointer &hp)
Definition: client_side.cc:1203
static int clientIsRequestBodyTooLargeForPolicy(int64_t bodyLength)
Definition: client_side.cc:710
static bool AddOpenedHttpSocket(const Comm::ConnectionPointer &conn)
find any unused HttpSockets[] slot and store fd there or return false
Definition: client_side.cc:3262
void clientSocketDetach(clientStreamNode *node, ClientHttpRequest *http)
Definition: client_side.cc:860
static void clientUpdateHierCounters(HierarchyLogEntry *)
Definition: client_side.cc:276
void clientSetKeepaliveFlag(ClientHttpRequest *http)
decide whether to expect multiple requests on the corresponding connection
Definition: client_side.cc:698
void clientPackTermBound(String boundary, MemBuf *mb)
put terminating boundary for multiparts to the buffer
Definition: client_side.cc:726
static char * prepareAcceleratedURL(ConnStateData *conn, const Http1::RequestParserPointer &hp)
Definition: client_side.cc:1099
static void ClientSocketContextPushDeferredIfNeeded(Http::StreamPointer deferredRequest, ConnStateData *conn)
Definition: client_side.cc:896
void clientSocketRecipient(clientStreamNode *node, ClientHttpRequest *http, HttpReply *rep, StoreIOBuffer receivedData)
Definition: client_side.cc:824
int varyEvaluateMatch(StoreEntry *entry, HttpRequest *request)
Definition: client_side.cc:3422
static void clientUpdateStatCounters(const LogTags &logType)
Definition: client_side.cc:211
std::ostream & operator<<(std::ostream &os, const ConnStateData::PinnedIdleContext &pic)
Definition: client_side.cc:4050
void clientAclChecklistFill(ACLFilledChecklist &checklist, ClientHttpRequest *http)
Definition: client_side.cc:3494
static void httpsSslBumpStep2AccessCheckDone(Acl::Answer answer, void *data)
Definition: client_side.cc:2928
void clientStartListeningOn(AnyP::PortCfgPointer &port, const RefCount< CommCbFunPtrCallT< CommAcceptCbPtrFun > > &subCall, const Ipc::FdNoteId fdNote)
accept requests to a given port and inform subCall about them
Definition: client_side.cc:3322
ACLFilledChecklist * clientAclChecklistCreate(const acl_access *acl, ClientHttpRequest *http)
Definition: client_side.cc:3486
void clientPackRangeHdr(const HttpReplyPointer &rep, const HttpHdrRangeSpec *spec, String boundary, MemBuf *mb)
append a "part" HTTP header (as in a multi-part/range reply) to the buffer
Definition: client_side.cc:733
int commSetConnTimeout(const Comm::ConnectionPointer &conn, time_t timeout, AsyncCall::Pointer &callback)
Definition: comm.cc:595
AsyncCall::Pointer comm_add_close_handler(int fd, CLCB *handler, void *data)
Definition: comm.cc:949
void comm_remove_close_handler(int fd, CLCB *handler, void *data)
Definition: comm.cc:978
#define debug_log
change-avoidance macro; new code should call DebugStream() instead
Definition: Stream.h:183
int opt_no_daemon
int opt_foreground
const char * dash_str
char const * visible_appname_string
void clientStreamAbort(clientStreamNode *thisObject, ClientHttpRequest *http)
Definition: clientStream.cc:235
void clientStreamInit(dlink_list *list, CSR *func, CSD *rdetach, CSS *readstatus, ClientStreamData readdata, CSCB *callback, CSD *cdetach, ClientStreamData callbackdata, StoreIOBuffer tailBuffer)
Definition: clientStream.cc:112
void clientStreamDetach(clientStreamNode *thisObject, ClientHttpRequest *http)
Definition: clientStream.cc:192
const char * fqdncache_gethostbyaddr(const Ip::Address &addr, int flags)
Definition: fqdncache.cc:481
Security::ContextPointer GenerateSslContext(CertificateProperties const &, Security::ServerOptions &, bool trusted)
Definition: support.cc:956
bool configureSSL(SSL *ssl, CertificateProperties const &properties, AnyP::PortCfg &port)
Definition: support.cc:1002
void InRamCertificateDbKey(const Ssl::CertificateProperties &certProperties, SBuf &key)
Definition: support.cc:1390
Security::ContextPointer createSSLContext(Security::CertPointer &x509, Security::PrivateKeyPointer &pkey, Security::ServerOptions &)
Create SSL context and apply ssl certificate and private key to it.
Definition: support.cc:925
bool verifySslCertificate(const Security::ContextPointer &, CertificateProperties const &)
Definition: support.cc:1045
bool checkX509ServerValidity(X509 *cert, const char *server)
Definition: support.cc:254
bool configureSSLUsingPkeyAndCertFromMemory(SSL *ssl, const char *data, AnyP::PortCfg &port)
Definition: support.cc:1025
Security::ContextPointer GenerateSslContextUsingPkeyAndCertFromMemory(const char *data, Security::ServerOptions &, bool trusted)
Definition: support.cc:942
void configureUnconfiguredSslContext(Security::ContextPointer &, Ssl::CertSignAlgorithm signAlgorithm, AnyP::PortCfg &)
Definition: support.cc:995
SBuf httpMakeVaryMark(HttpRequest *request, HttpReply const *reply)
Definition: http.cc:588
char * internalLocalUri(const char *dir, const SBuf &name)
Definition: internal.cc:140
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:25
uint16_t KnownPort
validated/supported port number; these values are never zero
Definition: UriScheme.h:23
void ReadCancel(int fd, AsyncCall::Pointer &callback)
Cancel the read pending on FD. No action if none pending.
Definition: Read.cc:219
void ResetSelect(int fd)
reset/undo/unregister the watch for an FD which was set by Comm::SetSelect()
Definition: Loops.h:30
void Read(const Comm::ConnectionPointer &conn, AsyncCall::Pointer &callback)
Definition: Read.cc:40
void SetSelect(int, unsigned int, PF *, void *, time_t)
Mark an FD to be watched for its IO status.
Definition: ModDevPoll.cc:223
bool ResolveClientAddressesAsap
whether to do reverse DNS lookups for source IPs of accepted connections
Definition: fqdncache.cc:30
ConnStateData * NewServer(const MasterXactionPointer &xact)
create a new HTTP connection handler; never returns NULL
Definition: Http1Server.cc:391
AnyP::ProtocolVersion ProtocolVersion(unsigned int aMajor, unsigned int aMinor)
HTTP version label information.
Definition: ProtocolVersion.h:19
ConnStateData * NewServer(const MasterXactionPointer &xact)
create a new HTTPS connection handler; never returns NULL
Definition: Http1Server.cc:397
void Start(const Comm::ConnectionPointer &conn, IDCB *callback, void *cbdata)
Definition: Ident.cc:264
FdNoteId
We cannot send char* FD notes to other processes. Pass int IDs and convert.
Definition: FdNotes.h:20
void StartListening(int sock_type, int proto, const Comm::ConnectionPointer &listenConn, FdNoteId, StartListeningCallback &)
Definition: StartListening.cc:32
SBuf IssuerName(Certificate &)
The Issuer field of the given certificate (if found) or an empty SBuf.
Definition: Certificate.cc:28
bool CreateServerSession(const Security::ContextPointer &, const Comm::ConnectionPointer &, Security::PeerOptions &, const char *squidCtx)
Definition: Session.cc:193
IoResult Accept(Comm::Connection &transport)
accept a TLS connection over the specified to-Squid transport connection
Definition: Io.cc:197
bool SessionIsResumed(const Security::SessionPointer &)
whether the session is a resumed one
Definition: Session.cc:212
SBuf SubjectName(Certificate &)
The SubjectName field of the given certificate (if found) or an empty SBuf.
Definition: Certificate.cc:68
Security::ContextPointer GetFrom(Security::SessionPointer &s)
Helper function to retrieve a (non-locked) ContextPointer from a SessionPointer.
Definition: Session.h:105
GlobalContextStorage TheGlobalContextStorage
Global cache for store all SSL server certificates.
Definition: context_storage.cc:123
void Controller::create() STUB void Controller Controller nil
Definition: stub_libstore.cc:19
size_t headers_sz
Response header bytes written to the client connection.
Definition: client_side_request.h:158
uint64_t size
Response header and body bytes written to the client connection.
Definition: client_side_request.h:156
Definition: parse.c:104
Definition: parse.c:160
void tvSub(struct timeval &res, struct timeval const &t1, struct timeval const &t2)
Definition: gadgets.cc:58
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
Definition: gadgets.cc:17