client_side.cc
Go to the documentation of this file.
157 typedef void (*Handler)(AnyP::PortCfgPointer &portCfg, const Ipc::FdNoteId note, const Subscription::Pointer &sub);
158 ListeningStartedDialer(Handler aHandler, AnyP::PortCfgPointer &aPortCfg, const Ipc::FdNoteId note, const Subscription::Pointer &aSub):
183 static void clientListenerConnectionOpened(AnyP::PortCfgPointer &s, const Ipc::FdNoteId portTypeNote, const Subscription::Pointer &sub);
193 static void ClientSocketContextPushDeferredIfNeeded(Http::StreamPointer deferredRequest, ConnStateData * conn);
398 al->cache.objectSize = loggingEntry()->contentLen(); // payload duplicate ?? with or without TE ?
406 al->http.clientReplySz.payloadData = out.size - out.headers_sz; // pretend its all un-encoded data for now.
507 debugs(33, 2, "WARNING: Ignoring duplicate connection-auth for " << clientConnection << " from " << by);
548 debugs(33, 2, "WARNING: Graceful closure on " << clientConnection << " due to connection-auth erase from " << by);
551 // XXX: need to test whether the connection re-auth challenge is sent. If not, how to trigger it from here.
552 // NP: the current situation seems to fix challenge loops in Safari without visible issues in others.
553 // we stop receiving more traffic but can leave the Job running to terminate after the error or challenge is delivered.
560 debugs(33, 2, "ERROR: Closing " << clientConnection << " due to change of connection-auth from " << by);
577 AsyncCall::Pointer callback = JobCallback(33, 5, TimeoutDialer, this, ConnStateData::requestTimeout);
585 AsyncCall::Pointer callback = JobCallback(5, 4, TimeoutDialer, this, ConnStateData::lifetimeTimeout);
652 debugs(33, DBG_IMPORTANT, "ERROR: Squid BUG: ConnStateData did not close " << clientConnection);
655 debugs(33, DBG_IMPORTANT, "ERROR: Squid BUG: ConnStateData was not destroyed properly; " << clientConnection);
709 clientPackRangeHdr(const HttpReplyPointer &rep, const HttpHdrRangeSpec * spec, String boundary, MemBuf * mb)
760 debugs(33, 6, "clientMRangeCLen: (clen += " << mb.size << " + " << (*pos)->length << ") == " << clen);
804 if (!http->getConn() || !cbdataReferenceValid(http->getConn()) || !Comm::IsConnOpen(http->getConn()->clientConnection))
872 ClientSocketContextPushDeferredIfNeeded(Http::StreamPointer deferredRequest, ConnStateData * conn)
902 debugs(33, 2, clientConnection << " Connection was pinned but server side gone. Terminating client connection");
1094 static const CharacterSet uriScheme = CharacterSet("URI-scheme","+-.") + CharacterSet::ALPHA + CharacterSet::DIGIT;
1145 snprintf(uri, url_sz, SQUIDSBUFPH "://" SQUIDSBUFPH SQUIDSBUFPH, SQUIDSBUFPRINT(scheme), SQUIDSBUFPRINT(host), SQUIDSBUFPRINT(url));
1149 debugs(33, 5, "ACCEL DEFAULTSITE REWRITE: defaultsite=" << conn->port->defaultsite << " + vport=" << vport);
1156 const int url_sz = scheme.length() + strlen(conn->port->defaultsite) + sizeof(vportStr) + url.length() + 32;
1257 /* Attempt to parse the first line; this will define where the method, url, version and header begin */
1296 debugs(33, DBG_IMPORTANT, "WARNING: CONNECT method received on " << transferProtocol << " Accelerator port " << port->s.port());
1297 debugs(33, DBG_IMPORTANT, "WARNING: for request: " << hp->method() << " " << hp->requestUri() << " " << hp->messageProtocol());
1307 debugs(33, DBG_IMPORTANT, "WARNING: PRI method received on " << transferProtocol << " port " << port->s.port());
1308 debugs(33, DBG_IMPORTANT, "WARNING: for request: " << hp->method() << " " << hp->requestUri() << " " << hp->messageProtocol());
1314 debugs(33, DBG_IMPORTANT, "WARNING: Unsupported method: " << hp->method() << " " << hp->requestUri() << " " << hp->messageProtocol());
1485 const auto sslErrors = std::make_unique<Security::CertErrors>(Security::CertError(SQUID_X509_V_ERR_DOMAIN_MISMATCH, srvCert));
1501 const auto err = new ErrorState(ERR_SECURE_CONNECT_FAIL, Http::scServiceUnavailable, request, http->al);
1560 if (request != nullptr && request->flags.resetTcp && Comm::IsConnOpen(conn->clientConnection)) {
1568 clientProcessRequest(ConnStateData *conn, const Http1::RequestParserPointer &hp, Http::Stream *context)
1594 ((request->flags.sslBumped || conn->port->transport.protocol == AnyP::PROTO_HTTPS) ? Http::Message::srcHttps : Http::Message::srcHttp);
1634 repContext->setReplyToError(ERR_INVALID_REQ, frameStatus, nullptr, conn, request.getRaw(), nullptr, nullptr);
1745 debugs(33, 3, clientConnection << " max concurrent requests reached (" << concurrentRequestLimit << ")");
1812 debugs(33, 5, "PROXY/" << proxyProtocolHeader_->version() << " upgrade: " << clientConnection);
1903 debugs(33, 5, "monitoring half-closed while processing parsed requests: " << clientConnection);
2083 const err_type error = receivedFirstByte_ ? ERR_REQUEST_PARSE_TIMEOUT : ERR_REQUEST_START_TIMEOUT;
2139 debugs(33, 2, "WARNING: Path MTU discovery disabling failed on " << clientConnection << " : " << xstrerr(xerrno));
2145 debugs(33, DBG_IMPORTANT, "WARNING: Path MTU discovery disabling is not supported on your platform.");
2296 debugs(83, (handshakeResult.important ? Important(62) : 2), "ERROR: Cannot accept a TLS connection" <<
2342 debugs(83, 4, "With " OPENSSL_VERSION_TEXT ", session details are available only defining ALLOW_ALWAYS_SSL_SESSION_DETAIL=1 in the source.");
2421 debugs(33, 2, "sslBump action " << Ssl::bumpMode(answer.kind) << "needed for " << connState->clientConnection);
2448 debugs(33, 2, "httpsAccept: " << params.port->listenConn << ": accept failure: " << xstrerr(params.xerrno));
2509 ACLFilledChecklist::NonBlockingCheck(std::move(acl_checklist), httpsSslBumpAccessCheckDone, this);
2531 debugs(33, 3, "Connection gone while waiting for ssl_crtd helper reply; helper reply:" << reply);
2536 debugs(33, 5, "Certificate for " << tlsConnectHostOrIp << " cannot be generated. ssl_crtd response: " << reply);
2541 if (reply_message.parse(reply.other().content(), reply.other().contentSize()) != Ssl::CrtdMessage::OK) {
2545 debugs(33, 5, "Certificate for " << tlsConnectHostOrIp << " cannot be generated. ssl_crtd response: " << reply_message.getBody());
2547 debugs(33, 5, "Certificate for " << tlsConnectHostOrIp << " was successfully received from ssl_crtd");
2548 if (sslServerBump && (sslServerBump->act.step1 == Ssl::bumpPeek || sslServerBump->act.step1 == Ssl::bumpStare)) {
2551 bool ret = Ssl::configureSSLUsingPkeyAndCertFromMemory(ssl, reply_message.getBody().c_str(), *port);
2558 Security::ContextPointer ctx(Ssl::GenerateSslContextUsingPkeyAndCertFromMemory(reply_message.getBody().c_str(), port->secure, (signAlgorithm == Ssl::algSignTrusted)));
2573 certProperties.commonName = sslCommonName_.isEmpty() ? tlsConnectHostOrIp.c_str() : sslCommonName_.c_str();
2647 ConnStateData::getTlsContextFromCache(const SBuf &cacheKey, const Ssl::CertificateProperties &certProperties)
2650 Ssl::LocalContextStorage * ssl_ctx_cache = Ssl::TheGlobalContextStorage.getLocalStorage(port->s);
2656 debugs(33, 5, "Cached SSL certificate for " << certProperties.commonName << " is out of date. Delete this certificate from cache");
2667 Ssl::LocalContextStorage *ssl_ctx_cache = Ssl::TheGlobalContextStorage.getLocalStorage(port->s);
2682 if (!(sslServerBump && (sslServerBump->act.step1 == Ssl::bumpPeek || sslServerBump->act.step1 == Ssl::bumpStare))) {
2696 debugs(33, 5, "Generating SSL certificate for " << certProperties.commonName << " using ssl_crtd.");
2713 if (sslServerBump && (sslServerBump->act.step1 == Ssl::bumpPeek || sslServerBump->act.step1 == Ssl::bumpStare)) {
2722 Security::ContextPointer dynCtx(Ssl::GenerateSslContext(certProperties, port->secure, (signAlgorithm == Ssl::algSignTrusted)));
2744 debugs(83, DBG_IMPORTANT, "Closing " << clientConnection->remote << " as lacking TLS context");
2882 if (!sslServerBump || sslServerBump->act.step1 == Ssl::bumpClientFirst) { // Either means client-first.
2891 FwdState::Start(clientConnection, sslServerBump->entry, sslServerBump->request.getRaw(), http ? http->al : nullptr);
2975 auto acl_checklist = ACLFilledChecklist::Make(Config.accessList.ssl_bump, sslServerBump->request.getRaw());
2980 ACLFilledChecklist::NonBlockingCheck(std::move(acl_checklist), httpsSslBumpStep2AccessCheckDone, this);
2985 Security::ContextPointer unConfiguredCTX(Ssl::createSSLContext(port->secure.signingCa.cert, port->secure.signingCa.pkey, port->secure));
3015 FwdState::Start(clientConnection, sslServerBump->entry, sslServerBump->request.getRaw(), http ? http->al : nullptr);
3044 debugs(83, (handshakeResult.important ? DBG_IMPORTANT : 2), "ERROR: Cannot SslBump-accept a TLS connection" <<
3063 debugs(33, 5, "PeekAndSplice mode, proceed with client negotiation. Current state:" << SSL_state_string_long(ssl));
3075 Must(pipeline.empty() || pipeline.front()->http == nullptr || pipeline.front()->http->request == pic.request.getRaw());
3089 ConnStateData::initiateTunneledRequest(HttpRequest::Pointer const &cause, const char *reason, const SBuf &payload)
3165 ConnStateData::buildFakeRequest(SBuf &useHost, const AnyP::KnownPort usePort, const SBuf &payload)
3202 request->sources |= ((switchedToHttps() || port->transport.protocol == AnyP::PROTO_HTTPS) ? Http::Message::srcHttps : Http::Message::srcHttp);
3260 debugs(33, DBG_IMPORTANT, "WARNING: No ssl_bump configured. Disabling ssl-bump on " << scheme << "_port " << s->s);
3264 debugs(1, DBG_IMPORTANT, "Will not bump SSL at " << scheme << "_port " << s->s << " due to TLS initialization failure.");
3277 debugs(1, DBG_CRITICAL, "ERROR: Ignoring " << scheme << "_port " << s->s << " due to TLS context initialization failure.");
3293 clientStartListeningOn(AnyP::PortCfgPointer &port, const RefCount< CommCbFunPtrCallT<CommAcceptCbPtrFun> > &subCall, const Ipc::FdNoteId fdNote)
3321 clientListenerConnectionOpened(AnyP::PortCfgPointer &s, const Ipc::FdNoteId portTypeNote, const Subscription::Pointer &sub)
3341 Must(AddOpenedHttpSocket(s->listenConn)); // otherwise, we have received a fd we did not ask for
3518 return clientConnection != nullptr && (clientConnection->flags & (COMM_TRANSPARENT|COMM_INTERCEPTION));
3634 AsyncCall::Pointer call = JobCallback(33, 5, Dialer, this, HttpControlMsgSink::wroteControlMsg);
3678 ConnStateData::pinBusyConnection(const Comm::ConnectionPointer &pinServer, const HttpRequest::Pointer &request)
3699 ConnStateData::pinConnection(const Comm::ConnectionPointer &pinServer, const HttpRequest &request)
3787 debugs(83, DBG_IMPORTANT, pinning.serverConnection << " TLS SSL_ERROR_WANT_WRITE request for idle pinned connection");
void Read(const Comm::ConnectionPointer &conn, AsyncCall::Pointer &callback)
Definition: Read.cc:40
bool shouldCloseOnEof() const override
whether to stop serving our client after reading EOF on its connection
Definition: client_side.cc:1389
bool shouldPreserveClientData() const
Definition: client_side.cc:3972
Definition: parse.c:104
Definition: LogTags.h:69
Definition: AsyncJob.h:31
Definition: TeChunkedParser.h:51
void checkpoint(const Connection &, const Acl::ChecklistFiller &)
Definition: KeyLogger.h:50
virtual void clientPinnedConnectionClosed(const CommCloseCbParams &io)
Our close handler called by Comm when the pinned connection is closed.
Definition: client_side.cc:3660
AsyncCall::Pointer comm_add_close_handler(int fd, CLCB *handler, void *data)
Definition: comm.cc:952
void clientAfterReadingRequests()
Definition: client_side.cc:1417
SBuf tlsClientSni_
TLS client delivered SNI value. Empty string if none has been received.
Definition: client_side.h:490
void pinConnection(const Comm::ConnectionPointer &pinServerConn, const HttpRequest &request)
Forward future client requests using the given server connection.
Definition: client_side.cc:3699
virtual void processParsedRequest(Http::StreamPointer &)=0
start processing a freshly parsed request
void fillConnectionLevelDetails(ACLFilledChecklist &) const
Definition: client_side.cc:3499
const char * findTrailingHTTPVersion(const char *uriAndHTTPVersion, const char *end)
Definition: client_side.cc:1052
void fillChecklist(ACLFilledChecklist &) const override
configure the given checklist (to reflect the current transaction state)
Definition: client_side.cc:3482
Definition: gadgets.h:231
Definition: FilledChecklist.h:33
void pinBusyConnection(const Comm::ConnectionPointer &pinServerConn, const HttpRequest::Pointer &request)
Definition: client_side.cc:3678
void clientProcessRequestFinished(ConnStateData *conn, const HttpRequest::Pointer &request)
Definition: client_side.cc:1552
void InRamCertificateDbKey(const Ssl::CertificateProperties &certProperties, SBuf &key)
Definition: support.cc:1481
void appendf(const char *fmt,...) PRINTF_FORMAT_ARG2
Append operation with printf-style arguments.
Definition: Packable.h:61
Definition: CommCalls.h:92
void stopPinnedConnectionMonitoring()
The caller assumes responsibility for connection closure detection.
Definition: client_side.cc:3756
Definition: ProxyCerts.h:38
void lifetimeTimeout(const CommTimeoutCbParams ¶ms)
Definition: client_side.cc:2101
const char * stoppedSending() const
true if we stopped sending the response
Definition: client_side.h:161
Definition: Acl.h:53
struct SquidConfig::@98 accessList
Security::CertPointer signWithX509
Certificate to sign the generated request.
Definition: gadgets.h:236
void getSslContextStart()
Start to create dynamic Security::ContextPointer for host or uses static port SSL context.
Definition: client_side.cc:2675
void setAuth(const Auth::UserRequest::Pointer &aur, const char *cause)
Definition: client_side.cc:494
struct ClientHttpRequest::Redirect redirect
void retrieveParsedInfo(Security::TlsDetails::Pointer const &details)
Extract information from parser stored in TlsDetails object.
Definition: NegotiationHistory.cc:95
void resetSslCommonName(const char *name)
Definition: client_side.h:293
Definition: HttpHeaderRange.h:26
AsyncCall::Pointer cbControlMsgSent
Call to schedule when the control msg has been sent.
Definition: HttpControlMsg.h:42
static void clientUpdateHierCounters(HierarchyLogEntry *)
Definition: client_side.cc:263
Security::ContextPointer GetFrom(Security::SessionPointer &s)
Helper function to retrieve a (non-locked) ContextPointer from a SessionPointer.
Definition: Session.h:109
acl_access * on_unsupported_protocol
Definition: SquidConfig.h:400
Definition: bio.h:70
void initRequest(HttpRequest *)
Definition: client_side_request.cc:1511
bool needsMoreSpace() const
Definition: TeChunkedParser.cc:82
bool proxyProtocolError(const char *reason)
Definition: client_side.cc:1778
int varyEvaluateMatch(StoreEntry *entry, HttpRequest *request)
Definition: client_side.cc:3393
void sslCrtdHandleReply(const Helper::Reply &reply)
Process response from ssl_crtd.
Definition: client_side.cc:2528
std::unique_ptr< ACLFilledChecklist > MakingPointer
Definition: FilledChecklist.h:41
bool empty() const
whether there are none or any requests currently pipelined
Definition: Pipeline.h:56
AnyP::PortCfgPointer port
the configuration listening port this call relates to (may be nil)
Definition: CommCalls.h:100
struct StatCounters::@117 cd
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:1016
Comm::ConnectionPointer borrowPinnedConnection(HttpRequest *, const AccessLogEntryPointer &)
ConnStateData-specific part of BorrowPinnedConnection()
Definition: client_side.cc:3837
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:3293
void error(char *format,...)
static void Submit(CrtdMessage const &message, HLPCB *callback, void *data)
Submit crtd message to external crtd server.
Definition: helper.cc:123
void setWriteLimiter(const int aWriteSpeedLimit, const double anInitialBurst, const double aHighWatermark)
Definition: comm.cc:1358
void sendControlMsg(HttpControlMsg) override
called to send the 1xx message and notify the Source
Definition: client_side.cc:3614
std::vector< ClientDelayPool::Pointer > pools
Definition: ClientDelayConfig.h:47
Definition: CachePeer.h:28
a smart AsyncCall pointer for delivery of future results
Definition: AsyncCallbacks.h:31
static void httpsSslBumpStep2AccessCheckDone(Acl::Answer answer, void *data)
Definition: client_side.cc:2899
bool splice()
Splice a bumped client connection on peek-and-splice mode.
Definition: client_side.cc:2930
Definition: LogTags.h:17
const char * stoppedReceiving_
the reason why we no longer read the request or nil
Definition: client_side.h:501
void enableAutoConsumption()
start or continue consuming when producing without consumer
Definition: BodyPipe.cc:316
int64_t mayNeedToReadMoreBody() const
Definition: client_side.cc:3533
struct ClientHttpRequest::Flags flags
void clientdbUpdate(const Ip::Address &addr, const LogTags <ype, AnyP::ProtocolType p, size_t size)
Definition: client_db.cc:138
Definition: Server.h:31
int clientdbEstablished(const Ip::Address &addr, int delta)
Definition: client_db.cc:182
void noteBodyConsumerAborted(BodyPipe::Pointer) override=0
Definition: client_side.cc:2067
struct SquidConfig::@97 onoff
Auth::UserRequest::Pointer auth_user_request
Definition: HttpRequest.h:127
Security::KeyLogger keyLogger
managers logging of the being-accepted TLS connection secrets
Definition: client_side.h:384
struct ClientHttpRequest::Out out
Security::CertErrors * sslErrors() const
SSL [certificate validation] errors.
Definition: ServerBump.cc:66
struct ConnStateData::@35 flags
ACLFilledChecklist::MakingPointer clientAclChecklistCreate(const acl_access *acl, ClientHttpRequest *http)
Definition: client_side.cc:3457
@ tlsBump3
AccessLogEntry::Pointer al
info for the future access.log, and external ACL
Definition: FilledChecklist.h:124
Http1::TeChunkedParser * bodyParser
parses HTTP/1.1 chunked request body
Definition: client_side.h:108
void add(const Http::StreamPointer &)
register a new request context to the pipeline
Definition: Pipeline.cc:20
std::vector< HttpHdrRangeSpec * >::iterator iterator
Definition: HttpHeaderRange.h:65
void accessLogLog(const AccessLogEntryPointer &, ACLChecklist *)
Definition: access_log.cc:136
void handleSslBumpHandshakeError(const Security::IoResult &)
process a problematic Security::Accept() result on the SslBump code path
Definition: client_side.cc:3020
Definition: AccessLogEntry.h:40
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 void sslCrtdHandleReplyWrapper(void *data, const Helper::Reply &reply)
Callback function. It is called when squid receive message from ssl_crtd.
Definition: client_side.cc:2521
Definition: CommCalls.h:280
struct StatCounters::@111 client_http
CbcPointer< Security::CertErrors > sslErrors
Definition: FilledChecklist.h:117
Definition: UriScheme.h:31
SBuf SubjectName(Certificate &)
The SubjectName field of the given certificate (if found) or an empty SBuf.
Definition: Certificate.cc:68
static void clientListenerConnectionOpened(AnyP::PortCfgPointer &s, const Ipc::FdNoteId portTypeNote, const Subscription::Pointer &sub)
process clientHttpConnectionsOpen result
Definition: client_side.cc:3321
RefCount< AsyncCallT< Dialer > > asyncCall(int aDebugSection, int aDebugLevel, const char *aName, const Dialer &aDialer)
Definition: AsyncCall.h:156
SBuf httpMakeVaryMark(HttpRequest *request, HttpReply const *reply)
Definition: http.cc:589
void checkForInternalAccess()
Checks whether the current request is internal and adjusts it accordingly.
Definition: client_side_request.cc:1550
bool ResolveClientAddressesAsap
whether to do reverse DNS lookups for source IPs of accepted connections
Definition: fqdncache.cc:30
void syncAle(HttpRequest *adaptedRequest, const char *logUri) const override
assigns uninitialized adapted_request and url ALE components
Definition: FilledChecklist.cc:110
ConnStateData * NewServer(const MasterXactionPointer &xact)
create a new HTTP connection handler; never returns NULL
Definition: Http1Server.cc:392
char * toStr(char *buf, const unsigned int blen, int force=AF_UNSPEC) const
Definition: Address.cc:812
struct SquidConfig::@106 ssl_client
class AccessLogEntry::HttpDetails http
int opt_no_daemon
void startPinnedConnectionMonitoring()
Definition: client_side.cc:3744
void finishDechunkingRequest(bool withSuccess)
put parsed content into input buffer and clean up
Definition: client_side.cc:3591
void stopReceiving(const char *error)
note request receiving error and close as soon as we write the response
Definition: client_side.cc:3551
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: BodyPipe.h:90
void clientStreamDetach(clientStreamNode *thisObject, ClientHttpRequest *http)
Definition: clientStream.cc:192
size_t headers_sz
Response header bytes written to the client connection.
Definition: client_side_request.h:155
void(* Handler)(AnyP::PortCfgPointer &portCfg, const Ipc::FdNoteId note, const Subscription::Pointer &sub)
Definition: client_side.cc:157
Http::Stream * parseHttpRequest(const Http1::RequestParserPointer &)
Definition: client_side.cc:1255
Definition: clientStream.h:75
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:25
static void Reset()
forgets the current context, setting it to nil/unknown
Definition: CodeContext.cc:77
HttpRequest::Pointer request
faked, minimal request; required by Client API
Definition: ServerBump.h:53
void ReadCancel(int fd, AsyncCall::Pointer &callback)
Cancel the read pending on FD. No action if none pending.
Definition: Read.cc:219
class AccessLogEntry::IcapLogEntry icap
void postHttpsAccept()
the second part of old httpsAccept, waiting for future HttpsServer home
Definition: client_side.cc:2465
Definition: HttpRequest.h:48
Ssl::ServerBump * sslServerBump
HTTPS server cert. fetching state for bump-ssl-server-first.
Definition: client_side.h:494
bool multipartRangeRequest() const
Definition: client_side.cc:696
bool SessionIsResumed(const Security::SessionPointer &)
whether the session is a resumed one
Definition: Session.cc:213
const char * stoppedSending_
the reason why we no longer write the response or nil
Definition: client_side.h:499
void connStateClosed(const CommCloseCbParams &io)
Definition: client_side.cc:483
virtual Http::Stream * parseOneRequest()=0
unsigned int toHostStr(char *buf, const unsigned int len) const
Definition: Address.cc:862
void StartListening(int sock_type, int proto, const Comm::ConnectionPointer &listenConn, FdNoteId, StartListeningCallback &)
Definition: StartListening.cc:32
virtual void doneWithControlMsg()
Definition: HttpControlMsg.cc:15
void retrieveNegotiatedInfo(const Security::SessionPointer &)
Extract negotiation information from TLS object.
Definition: NegotiationHistory.cc:72
static MakingPointer Make(const acl_access *a, HttpRequest *r)
Definition: FilledChecklist.h:49
bool needProxyProtocolHeader_
whether PROXY protocol header is still expected
Definition: client_side.h:467
static const std::string code_new_certificate
String code for "new_certificate" messages.
Definition: crtd_message.h:76
void clearRequest()
resets the current request and log_uri to nil
Definition: client_side_request.cc:1584
Comm::ConnectionPointer tcpClient
the client TCP connection which originated this transaction
Definition: MasterXaction.h:66
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
Definition: gadgets.cc:18
parameters for the async notePinnedConnectionBecameIdle() call
Definition: client_side.h:182
Definition: StoreIOBuffer.h:15
const char * fqdncache_gethostbyaddr(const Ip::Address &addr, int flags)
Definition: fqdncache.cc:481
AnyP::Port tlsConnectPort
The TLS server port number as passed in the CONNECT request.
Definition: client_side.h:486
char * last_meta
image of the last ICAP response header or eCAP meta received
Definition: AccessLogEntry.h:183
virtual void handleReply(HttpReply *header, StoreIOBuffer receivedData)=0
Definition: client_side_request.h:30
@ tlsBump2
bundles HTTP 1xx reply and the "successfully forwarded" callback
Definition: HttpControlMsg.h:46
time_t timeLeft(const time_t idleTimeout) const
Definition: Connection.cc:143
void updateError(const Error &)
if necessary, stores new error information (if any)
Definition: client_side.cc:628
void clientSocketRecipient(clientStreamNode *node, ClientHttpRequest *http, HttpReply *rep, StoreIOBuffer receivedData)
Definition: client_side.cc:800
@ tlsBump1
static void httpsSslBumpAccessCheckDone(Acl::Answer answer, void *data)
Definition: client_side.cc:2412
Http::StreamPointer front() const
get the first request context in the pipeline
Definition: Pipeline.cc:28
LocalContextStorage * getLocalStorage(Ip::Address const &address)
Return the local storage for the given listening address/port.
Definition: context_storage.cc:80
Subscription::Pointer sub
The handler to be subscribed for this connection listener.
Definition: client_side.cc:180
uint16_t KnownPort
validated/supported port number; these values are never zero
Definition: UriScheme.h:23
ConnStateData * NewServer(const MasterXactionPointer &xact)
create a new HTTPS connection handler; never returns NULL
Definition: Http1Server.cc:398
Definition: client_side.h:79
Definition: MemBuf.h:23
Definition: CommCalls.h:113
void setReplyToStoreEntry(StoreEntry *e, const char *reason)
replaces current response store entry with the given one
Definition: client_side_reply.cc:151
clientStreamNode * getClientReplyContext() const
Definition: Stream.cc:511
static char * prepareAcceleratedURL(ConnStateData *conn, const Http1::RequestParserPointer &hp)
Definition: client_side.cc:1075
void configureUnconfiguredSslContext(Security::ContextPointer &, Ssl::CertSignAlgorithm signAlgorithm, AnyP::PortCfg &)
Definition: support.cc:1086
static void httpsEstablish(ConnStateData *connState, const Security::ContextPointer &ctx)
Definition: client_side.cc:2394
bool concurrentRequestQueueFilled() const
Definition: client_side.cc:1730
Definition: ClpMap.h:40
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:3089
static void NonBlockingCheck(MakingPointer &&p, ACLCB *cb, void *data)
Definition: FilledChecklist.h:54
void afterClientWrite(size_t) override
processing to sync state after a Comm::Write()
Definition: client_side.cc:983
void httpsPeeked(PinnedIdleContext pic)
called by FwdState when it is done bumping the server
Definition: client_side.cc:3071
bool preservingClientData_
whether preservedClientData is valid and should be kept up to date
Definition: client_side.h:434
void resetReadTimeout(time_t timeout)
(re)sets timeout for receiving more bytes from the client
Definition: client_side.cc:574
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:959
Definition: Reply.h:29
Adaptation::Icap::History::Pointer icapHistory() const
Returns possibly nil history, creating it if icap logging is enabled.
Definition: HttpRequest.cc:389
bool handleIdleClientPinnedTlsRead()
Definition: client_side.cc:3766
virtual int pipelinePrefetchMax() const
returning N allows a pipeline of 1+N requests (see pipeline_prefetch)
Definition: client_side.cc:1716
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
const char * visible_appname_string
Http::StreamPointer back() const
get the last request context in the pipeline
Definition: Pipeline.cc:40
CommCbFunPtrCallT< Dialer > * commCbCall(int debugSection, int debugLevel, const char *callName, const Dialer &dialer)
Definition: CommCalls.h:312
Http::Stream * abortRequestParsing(const char *const errUri)
stop parsing the request and create context for relaying error info
Definition: client_side.cc:998
Definition: SquidString.h:25
void setPayloadBuffer(MemBuf *parsedContent)
set the buffer to be used to store decoded chunk data
Definition: TeChunkedParser.h:58
class AccessLogEntry::CacheDetails cache
SBuf IssuerName(Certificate &)
The Issuer field of the given certificate (if found) or an empty SBuf.
Definition: Certificate.cc:28
Security::ContextPointer GenerateSslContextUsingPkeyAndCertFromMemory(const char *data, Security::ServerOptions &, bool trusted)
Definition: support.cc:1033
Definition: crtd_message.h:24
std::ostream & CurrentException(std::ostream &os)
prints active (i.e., thrown but not yet handled) exception
Definition: TextException.cc:88
BodyPipe::Pointer expectRequestBody(int64_t size)
Definition: client_side.cc:3522
void buildSslCertGenerationParams(Ssl::CertificateProperties &certProperties)
Definition: client_side.cc:2571
Definition: CommCalls.h:165
SBuf vary_headers
The variant second-stage cache key. Generated from Vary header pattern for this request.
Definition: HttpRequest.h:170
Security::PrivateKeyPointer signWithPkey
The key of the signing certificate.
Definition: gadgets.h:237
#define JobCallback(dbgSection, dbgLevel, Dialer, job, method)
Convenience macro to create a Dialer-based job callback.
Definition: AsyncJobCalls.h:70
Definition: HierarchyLogEntry.h:23
void packInto(Packable *p, bool mask_sensitive_info=false) const
Definition: HttpHeader.cc:539
Definition: TcpAcceptor.h:38
class AccessLogEntry::Headers headers
Definition: Tokenizer.h:29
Security::ContextPointer GenerateSslContext(CertificateProperties const &, Security::ServerOptions &, bool trusted)
Definition: support.cc:1047
Http::StatusCode checkEntityFraming() const
Definition: HttpRequest.cc:647
static char * prepareTransparentURL(ConnStateData *conn, const Http1::RequestParserPointer &hp)
Definition: client_side.cc:1230
bool CreateServerSession(const Security::ContextPointer &, const Comm::ConnectionPointer &, Security::PeerOptions &, const char *squidCtx)
Definition: Session.cc:194
void add(const Http::StreamPointer &context)
registers a newly created stream
Definition: client_side.cc:1702
int opt_foreground
bool proxyProtocolValidateClient()
Definition: client_side.cc:1759
Definition: ProxyCerts.h:17
void quitAfterError(HttpRequest *request)
Definition: client_side.cc:1431
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:1409
uint64_t size
Response header and body bytes written to the client connection.
Definition: client_side_request.h:153
static char * buildUrlFromHost(ConnStateData *conn, const Http1::RequestParserPointer &hp)
Definition: client_side.cc:1179
class AccessLogEntry::AdaptationDetails adapt
ProxyProtocol::HeaderPointer proxyProtocolHeader_
the parsed PROXY protocol header
Definition: client_side.h:470
static bool AddOpenedHttpSocket(const Comm::ConnectionPointer &conn)
find any unused HttpSockets[] slot and store fd there or return false
Definition: client_side.cc:3233
void setCode(std::string const &aCode)
Set new request/reply code to compose.
Definition: crtd_message.cc:126
Definition: ServerBump.h:33
void receivedFirstByte() override
Update flags and timeout after the first byte received.
Definition: client_side.cc:1824
void notePinnedConnectionBecameIdle(PinnedIdleContext pic)
Called when a pinned connection becomes available for forwarding the next request.
Definition: client_side.cc:3684
void clientAclChecklistFill(ACLFilledChecklist &checklist, ClientHttpRequest *http)
Definition: client_side.cc:3465
Definition: ErrorDetail.h:39
virtual bool canDial(AsyncCall &) const
Definition: client_side.cc:166
Definition: client_side_reply.h:22
void ResetSelect(int fd)
reset/undo/unregister the watch for an FD which was set by Comm::SetSelect()
Definition: Loops.h:30
const LogTags & loggingTags() const
the processing tags associated with this request transaction.
Definition: client_side_request.h:94
struct StatCounters::@118 netdb
void clientSetKeepaliveFlag(ClientHttpRequest *http)
decide whether to expect multiple requests on the corresponding connection
Definition: client_side.cc:674
virtual bool writeControlMsgAndCall(HttpReply *rep, AsyncCall::Pointer &call)=0
handle a control message received by context from a peer and call back
void prepareLogWithRequestDetails(HttpRequest *, const AccessLogEntryPointer &)
Definition: client_side.cc:322
void clientPinnedConnectionRead(const CommIoCbParams &io)
Definition: client_side.cc:3808
Adaptation::History::Pointer adaptLogHistory() const
Returns possibly nil history, creating it if adapt. logging is enabled.
Definition: HttpRequest.cc:415
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:2735
void switchToHttps(ClientHttpRequest *, Ssl::BumpMode bumpServerMode)
Definition: client_side.cc:2772
void abortChunkedRequestBody(const err_type error)
quit on errors related to chunked request body handling
Definition: client_side.cc:2034
void expectNoForwarding()
cleans up virgin request [body] forwarding state
Definition: client_side.cc:3571
ListeningStartedDialer(Handler aHandler, AnyP::PortCfgPointer &aPortCfg, const Ipc::FdNoteId note, const Subscription::Pointer &aSub)
Definition: client_side.cc:158
const Auth::UserRequest::Pointer & getAuth() const
Definition: client_side.h:123
void clientStreamInit(dlink_list *list, CSR *func, CSD *rdetach, CSS *readstatus, const ClientStreamData &readdata, CSCB *callback, CSD *cdetach, const ClientStreamData &callbackdata, StoreIOBuffer tailBuffer)
Definition: clientStream.cc:112
bool tunnelOnError(const err_type)
initiate tunneling if possible or return false otherwise
Definition: client_side.cc:1521
static Comm::ConnectionPointer BorrowPinnedConnection(HttpRequest *, const AccessLogEntryPointer &)
Definition: client_side.cc:3868
Definition: HttpReply.h:24
err_type handleChunkedRequestBody()
parses available chunked encoded body bytes, checks size, returns errors
Definition: client_side.cc:1993
GlobalContextStorage TheGlobalContextStorage
Global cache for store all SSL server certificates.
Definition: context_storage.cc:123
struct ConnStateData::@36 pinning
void startPeekAndSplice()
Initializes and starts a peek-and-splice negotiation with the SSL client.
Definition: client_side.cc:2964
void clientProcessRequest(ConnStateData *conn, const Http1::RequestParserPointer &hp, Http::Stream *context)
Definition: client_side.cc:1568
access to a callback result carried by an asynchronous CallDialer
Definition: AsyncCallbacks.h:18
std::ostream & operator<<(std::ostream &os, const ConnStateData::PinnedIdleContext &pic)
Definition: client_side.cc:4012
noteTakeServerConnectionControl() callback parameter
Definition: client_side.h:213
Definition: Store.h:37
void composeRequest(Ssl::CertificateProperties const &)
Definition: crtd_message.cc:235
Auth::UserRequest::Pointer auth_
some user details that can be used to perform authentication on this connection
Definition: client_side.h:474
void commSetConnTimeout(const Comm::ConnectionPointer &conn, time_t timeout, AsyncCall::Pointer &callback)
Definition: comm.cc:592
bool at(const BumpStep stp) const
whether we are currently performing the given processing step
Definition: ServerBump.h:47
ParseResult parse(const char *buffer, size_t len)
Definition: crtd_message.cc:23
bool serveDelayedError(Http::Stream *)
Definition: client_side.cc:1443
void wroteControlMsg(const CommIoCbParams &)
callback to handle Comm::Write completion
Definition: HttpControlMsg.cc:25
Definition: Notes.h:179
Definition: parse.c:160
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
Definition: SBuf.h:279
void afterClientRead() override
processing to be done after a Comm::Read()
Definition: client_side.cc:1910
Definition: ClientRequestContext.h:28
Definition: CommCalls.h:194
void httpHeaderAddContRange(HttpHeader *, HttpHdrRangeSpec, int64_t)
Definition: HttpHeaderTools.cc:76
Definition: AsyncCall.h:106
static void clientUpdateStatCounters(const LogTags &logType)
Definition: client_side.cc:198
Helps prints T object using object's T::printWithExtras() method.
Definition: IoManip.h:293
bool configureSSLUsingPkeyAndCertFromMemory(SSL *ssl, const char *data, AnyP::PortCfg &port)
Definition: support.cc:1116
struct SquidConfig::@84 Timeout
Error bareError
a problem that occurred without a request (e.g., while parsing headers)
Definition: client_side.h:381
void SetSelect(int, unsigned int, PF *, void *, time_t)
Mark an FD to be watched for its IO status.
Definition: ModDevPoll.cc:220
static ErrorState * NewForwarding(err_type, HttpRequestPointer &, const AccessLogEntryPointer &)
Creates a general request forwarding error with the right http_status.
Definition: errorpage.cc:691
bool verifySslCertificate(const Security::ContextPointer &, CertificateProperties const &)
Definition: support.cc:1136
Definition: Stream.h:72
void setRequest(HttpRequest *)
configure client request-related fields for the first time
Definition: FilledChecklist.cc:223
ConnStateData(const MasterXactionPointer &xact)
Definition: client_side.cc:2111
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:93
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:709
size_t req_sz
raw request size on input, not current request size
Definition: client_side_request.h:159
void manager(const CbcPointer< ConnStateData > &aMgr, const AccessLogEntryPointer &al)
associates the request with a from-client connection manager
Definition: HttpRequest.cc:774
static bool httpsCreate(const ConnStateData *connState, const Security::ContextPointer &ctx)
Create TLS connection structure and update fd_table.
Definition: client_side.cc:2263
void stopProducingFor(RefCount< BodyPipe > &, bool atEof)
Definition: BodyPipe.cc:107
AnyP::Port port
destination port of the request that caused serverConnection
Definition: client_side.h:145
Definition: CommCalls.h:133
LogTags_ot oldType
a set of client protocol, cache use, and other transaction outcome tags
Definition: LogTags.h:96
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
bool receivedFirstByte_
true if at least one byte received on this connection
Definition: Server.h:115
const char * stoppedReceiving() const
true if we stopped receiving the request
Definition: client_side.h:159
Definition: CommCalls.h:127
bool HasSubjectName(X509 &, const AnyP::Host &)
whether at least one common or alternate subject name matches the given one
Definition: support.cc:333
struct Http::Stream::@65 flags
void update(const Error &)
if necessary, stores the given error information (if any)
Definition: Error.cc:51
static int clientIsRequestBodyTooLargeForPolicy(int64_t bodyLength)
Definition: client_side.cc:686
IoResult Accept(Comm::Connection &transport)
accept a TLS connection over the specified to-Squid transport connection
Definition: Io.cc:211
ClientRequestContext * calloutContext
Definition: client_side_request.h:176
void checkLogging()
log the last (attempt at) transaction if nobody else did
Definition: client_side.cc:3953
optimized set of C chars, with quick membership test and merge support
Definition: CharacterSet.h:17
Definition: errorpage.h:88
Definition: ClientInfo.h:30
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:3216
Definition: CertError.h:19
StoreEntry * loggingEntry() const
Definition: client_side_request.h:65
bool connectedOk() const
whether there was a successful connection to (and peeking at) the origin server
Definition: ServerBump.h:44
virtual void callException(const std::exception &e)
called when the job throws during an async call
Definition: AsyncJob.cc:143
void setScheme(const AnyP::ProtocolType &p, const char *str)
convert the URL scheme to that given
Definition: Uri.h:61
struct SquidConfig::@92 Addrs
RawPointerT< Pointer > RawPointer(const char *label, const Pointer &ptr)
convenience wrapper for creating RawPointerT<> objects
Definition: IoManip.h:73
void storeTlsContextToCache(const SBuf &cacheKey, Security::ContextPointer &ctx)
Definition: client_side.cc:2665
bool fakeAConnectRequest(const char *reason, const SBuf &payload)
Definition: client_side.cc:3136
struct StatCounters::@113 icp
char * internalLocalUri(const char *dir, const SBuf &name)
Definition: internal.cc:139
static void ClientSocketContextPushDeferredIfNeeded(Http::StreamPointer deferredRequest, ConnStateData *conn)
Definition: client_side.cc:872
const SBuf & effectiveRequestUri() const
RFC 7230 section 5.5 - Effective Request URI.
Definition: HttpRequest.cc:744
Definition: AsyncCall.h:40
void updateError(const Error &)
if necessary, stores new error information (if any)
Definition: client_side_request.cc:1470
Definition: BodyPipe.h:61
bool configureSSL(SSL *ssl, CertificateProperties const &properties, AnyP::PortCfg &port)
Definition: support.cc:1093
bool setCommonName
Replace the CN field of the mimicking subject with the given.
Definition: gadgets.h:240
bool forceTunnel
whether to forward via TunnelStateData (instead of FwdState)
Definition: RequestFlags.h:120
thrown by modern "incremental" parsers when they need more data
Definition: forward.h:18
void unpinConnection(const bool andClose)
Undo pinConnection() and, optionally, close the pinned connection.
Definition: client_side.cc:3880
Security::NegotiationHistory * tlsNegotiations()
Definition: Connection.cc:153
void callException(const std::exception &) override
called when the job throws during an async call
Definition: client_side.cc:615
void clientPackTermBound(String boundary, MemBuf *mb)
put terminating boundary for multiparts to the buffer
Definition: client_side.cc:702
void comm_remove_close_handler(int fd, CLCB *handler, void *data)
Definition: comm.cc:981
void updateAle(const AccessLogEntry::Pointer &)
Definition: FilledChecklist.cc:242
HttpRequest::Pointer request
to-server request that initiated serverConnection
Definition: client_side.h:188
void clientStreamAbort(clientStreamNode *thisObject, ClientHttpRequest *http)
Definition: clientStream.cc:235
void print(std::ostream &os) const override
Definition: client_side.cc:162
ClientHttpRequest * buildFakeRequest(SBuf &useHost, AnyP::KnownPort usePort, const SBuf &payload)
build a fake http request
Definition: client_side.cc:3165
Definition: HttpHeader.h:74
char * prepareTlsSwitchingURL(const Http1::RequestParserPointer &hp)
Definition: client_side.cc:1196
Definition: ExceptionErrorDetail.h:22
void requestTimeout(const CommTimeoutCbParams ¶ms)
Definition: client_side.cc:2078
void tvSub(struct timeval &res, struct timeval const &t1, struct timeval const &t2)
Definition: gadgets.cc:58
Security::ContextPointer getTlsContextFromCache(const SBuf &cacheKey, const Ssl::CertificateProperties &certProperties)
Definition: client_side.cc:2647
bool parseProxyProtocolHeader()
Definition: client_side.cc:1799
ErrorDetail::Pointer MakeNamedErrorDetail(const char *name)
Definition: Detail.cc:54
static bool clientPingHasFinished(ping_data const *aPing)
Definition: client_side.cc:254
AnyP::ProtocolVersion ProtocolVersion(unsigned int aMajor, unsigned int aMinor)
HTTP version label information.
Definition: ProtocolVersion.h:19
void clientSocketDetach(clientStreamNode *node, ClientHttpRequest *http)
Definition: client_side.cc:836
Definition: ProtocolVersion.h:23
static Pointer MakePortful(const AnyP::PortCfgPointer &aPort)
Definition: MasterXaction.h:54
void terminateAll(const Error &, const LogTagsErrors &) override
abort any pending transactions and prevent new ones (by closing)
Definition: client_side.cc:3910
const std::string & getBody() const
Current body. If parsing is not finished the method returns incompleted body.
Definition: crtd_message.cc:120
static void clientUpdateStatHistCounters(const LogTags &logType, int svc_time)
Definition: client_side.cc:212
Definition: Subscription.h:48
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