Manages a control connection from an FTP client. More...

#include <FtpServer.h>

Inheritance diagram for Ftp::Server:
Collaboration diagram for Ftp::Server:

Public Types

typedef CbcPointer< AsyncJobPointer
 
typedef CbcPointer< BodyProducerPointer
 

Public Member Functions

 Server (const MasterXaction::Pointer &xact)
 
virtual ~Server () override
 
virtual void callException (const std::exception &e) override
 called when the job throws during an async call More...
 
void startWaitingForOrigin ()
 
void stopWaitingForOrigin (int status)
 
bool reading () const
 whether Comm::Read() is scheduled More...
 
virtual void receivedFirstByte ()
 Update flags and timeout after the first byte received. More...
 
virtual bool handleReadData ()
 
virtual void afterClientRead ()
 processing to be done after a Comm::Read() More...
 
virtual void afterClientWrite (size_t)
 processing to sync state after a Comm::Write() More...
 
virtual void sendControlMsg (HttpControlMsg)
 called to send the 1xx message and notify the Source More...
 
virtual void doneWithControlMsg ()
 
bool clientParseRequests ()
 Traffic parsing. More...
 
void readNextRequest ()
 
void kick ()
 try to make progress on a transaction or read more I/O More...
 
bool isOpen () const
 
int64_t mayNeedToReadMoreBody () const
 
const Auth::UserRequest::PointergetAuth () const
 
void setAuth (const Auth::UserRequest::Pointer &aur, const char *cause)
 
bool transparent () const
 
const char * stoppedReceiving () const
 true if we stopped receiving the request More...
 
const char * stoppedSending () const
 true if we stopped sending the response More...
 
void stopReceiving (const char *error)
 note request receiving error and close as soon as we write the response More...
 
void stopSending (const char *error)
 note response sending error and close as soon as we read the request More...
 
void expectNoForwarding ()
 cleans up virgin request [body] forwarding state More...
 
BodyPipe::Pointer expectRequestBody (int64_t size)
 
bool handleRequestBodyData ()
 
void notePinnedConnectionBecameIdle (PinnedIdleContext pic)
 Called when a pinned connection becomes available for forwarding the next request. More...
 
void pinBusyConnection (const Comm::ConnectionPointer &pinServerConn, const HttpRequest::Pointer &request)
 
void unpinConnection (const bool andClose)
 Undo pinConnection() and, optionally, close the pinned connection. More...
 
Comm::ConnectionPointer borrowPinnedConnection (HttpRequest *request)
 Returns validated pinnned server connection (and stops its monitoring). More...
 
const Comm::ConnectionPointer validatePinnedConnection (HttpRequest *request)
 
CachePeerpinnedPeer () const
 
bool pinnedAuth () const
 
void clientReadFtpData (const CommIoCbParams &io)
 
void connStateClosed (const CommCloseCbParams &io)
 
void requestTimeout (const CommTimeoutCbParams &params)
 
virtual bool doneAll () const
 whether positive goal has been reached More...
 
virtual void swanSong ()
 
void quitAfterError (HttpRequest *request)
 
void stopPinnedConnectionMonitoring ()
 The caller assumes responsibility for connection closure detection. More...
 
void postHttpsAccept ()
 the second part of old httpsAccept, waiting for future HttpsServer home More...
 
void startPeekAndSplice ()
 Initializes and starts a peek-and-splice negotiation with the SSL client. More...
 
void doPeekAndSpliceStep ()
 
void httpsPeeked (PinnedIdleContext pic)
 called by FwdState when it is done bumping the server More...
 
bool splice ()
 Splice a bumped client connection on peek-and-splice mode. More...
 
void getSslContextStart ()
 Start to create dynamic Security::ContextPointer for host or uses static port SSL context. More...
 
void getSslContextDone (Security::ContextPointer &)
 finish configuring the newly created SSL context" More...
 
void sslCrtdHandleReply (const Helper::Reply &reply)
 Proccess response from ssl_crtd. More...
 
void switchToHttps (ClientHttpRequest *, Ssl::BumpMode bumpServerMode)
 
void parseTlsHandshake ()
 
bool switchedToHttps () const
 
Ssl::ServerBumpserverBump ()
 
void setServerBump (Ssl::ServerBump *srvBump)
 
const SBufsslCommonName () const
 
void resetSslCommonName (const char *name)
 
const SBuftlsClientSni () const
 
void buildSslCertGenerationParams (Ssl::CertificateProperties &certProperties)
 
bool serveDelayedError (Http::Stream *)
 
char * prepareTlsSwitchingURL (const Http1::RequestParserPointer &hp)
 
void consumeInput (const size_t byteCount)
 remove no longer needed leading bytes from the input buffer More...
 
Http::StreamabortRequestParsing (const char *const errUri)
 stop parsing the request and create context for relaying error info More...
 
bool fakeAConnectRequest (const char *reason, const SBuf &payload)
 
bool initiateTunneledRequest (HttpRequest::Pointer const &cause, Http::MethodType const method, const char *reason, const SBuf &payload)
 generates and sends to tunnel.cc a fake request with a given payload More...
 
bool mayTunnelUnsupportedProto ()
 whether tunneling of unsupported protocol is allowed for this connection More...
 
ClientHttpRequestbuildFakeRequest (Http::MethodType const method, SBuf &useHost, unsigned short usePort, const SBuf &payload)
 build a fake http request More...
 
virtual void startShutdown ()
 
virtual void endingShutdown ()
 
NotePairs::Pointer notes ()
 
bool hasNotes () const
 
const ProxyProtocol::HeaderPointerproxyProtocolHeader () const
 
void readSomeData ()
 maybe grow the inBuf and schedule Comm::Read() More...
 
void stopReading ()
 cancels Comm::Read() if it is scheduled More...
 
virtual void writeSomeData ()
 maybe find some data to send and schedule a Comm::Write() More...
 
void write (MemBuf *mb)
 schedule some data for a Comm::Write() More...
 
void write (char *buf, int len)
 schedule some data for a Comm::Write() More...
 
bool writing () const
 whether Comm::Write() is scheduled More...
 
void maybeMakeSpaceAvailable ()
 grows the available read buffer space (if possible) More...
 
bool canBeCalled (AsyncCall &call) const
 whether we can be called More...
 
void callStart (AsyncCall &call)
 
virtual void callEnd ()
 called right after the called job method More...
 
virtual void * toCbdata ()=0
 
void wroteControlMsg (const CommIoCbParams &)
 callback to handle Comm::Write completion More...
 

Static Public Member Functions

static void sslCrtdHandleReplyWrapper (void *data, const Helper::Reply &reply)
 Callback function. It is called when squid receive message from ssl_crtd. More...
 
static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...
 

Public Attributes

MasterState::Pointer master
 info shared among our FTP client and server jobs More...
 
Http1::TeChunkedParserbodyParser
 parses HTTP/1.1 chunked request body More...
 
Ip::Address log_addr
 
struct {
   bool   readMore
 needs comm_read (for this request or new requests) More...
 
   bool   swanSang
 
flags
 
struct {
   Comm::ConnectionPointer   serverConnection
 
   char *   host
 
   int   port
 
   bool   pinned
 
   bool   auth
 
   bool   reading
 we are monitoring for peer connection closure More...
 
   bool   zeroReply
 server closed w/o response (ERR_ZERO_SIZE_OBJECT) More...
 
   CachePeer *   peer
 
   AsyncCall::Pointer   readHandler
 detects serverConnection closure More...
 
   AsyncCall::Pointer   closeHandler
 
pinning
 
Ssl::BumpMode sslBumpMode
 ssl_bump decision (Ssl::bumpEnd if n/a). More...
 
Security::HandshakeParser tlsParser
 
SBuf preservedClientData
 
Comm::ConnectionPointer clientConnection
 
AnyP::ProtocolVersion transferProtocol
 
SBuf inBuf
 read I/O buffer for the client connection More...
 
bool receivedFirstByte_
 true if at least one byte received on this connection More...
 
Pipeline pipeline
 set of requests waiting to be serviced More...
 
AsyncCall::Pointer cbControlMsgSent
 Call to schedule when the control msg has been sent. More...
 

Protected Types

enum  EarlyErrorKind {
  EarlyErrorKind::HugeRequest,
  EarlyErrorKind::MissingLogin,
  EarlyErrorKind::MissingUsername,
  EarlyErrorKind::MissingHost,
  EarlyErrorKind::UnsupportedCommand,
  EarlyErrorKind::InvalidUri,
  EarlyErrorKind::MalformedCommand
}
 
typedef bool(Ftp::Server::* RequestHandler) (String &cmd, String &params)
 a method handling an FTP command; selected by handleRequest() More...
 
typedef void(Ftp::Server::* ReplyHandler) (const HttpReply *reply, StoreIOBuffer data)
 a method handling an FTP response; selected by handleReply() More...
 

Protected Member Functions

virtual Http::StreamparseOneRequest () override
 
virtual void processParsedRequest (Http::StreamPointer &context) override
 start processing a freshly parsed request More...
 
virtual void notePeerConnection (Comm::ConnectionPointer conn) override
 called just before a FwdState-dispatched job starts using connection More...
 
virtual void clientPinnedConnectionClosed (const CommCloseCbParams &io) override
 Our close handler called by Comm when the pinned connection is closed. More...
 
virtual void handleReply (HttpReply *header, StoreIOBuffer receivedData) override
 
virtual int pipelinePrefetchMax () const override
 returning N allows a pipeline of 1+N requests (see pipeline_prefetch) More...
 
virtual bool writeControlMsgAndCall (HttpReply *rep, AsyncCall::Pointer &call) override
 handle a control message received by context from a peer and call back More...
 
virtual time_t idleTimeout () const override
 timeout to use when waiting for the next request More...
 
virtual void noteMoreBodySpaceAvailable (BodyPipe::Pointer) override
 
virtual void noteBodyConsumerAborted (BodyPipe::Pointer ptr) override
 
virtual void start () override
 called by AsyncStart; do not call directly More...
 
void acceptDataConnection (const CommAcceptCbParams &params)
 
void readUploadData (const CommIoCbParams &io)
 imports more upload data from the data connection More...
 
void wroteEarlyReply (const CommIoCbParams &io)
 
void wroteReply (const CommIoCbParams &io)
 
void wroteReplyData (const CommIoCbParams &io)
 called when we are done writing a chunk of the response data More...
 
void connectedForData (const CommConnectCbParams &params)
 Done establishing a data connection to the user. More...
 
unsigned int listenForDataConnection ()
 
bool createDataConnection (Ip::Address cltAddr)
 [Re]initializes dataConn for active data transfers. Does not connect. More...
 
void closeDataConnection ()
 
void userDataCompletionCheckpoint (int finalStatusCode)
 
void completeDataDownload ()
 
void calcUri (const SBuf *file)
 computes uri member from host and, if tracked, working dir with file name More...
 
void changeState (const Ftp::ServerState newState, const char *reason)
 
Http::StreamhandleUserRequest (const SBuf &cmd, SBuf &params)
 
bool checkDataConnPost () const
 Check that client data connection is ready for immediate I/O. More...
 
void replyDataWritingCheckpoint ()
 ClientStream checks after (actual or skipped) reply data writing. More...
 
void maybeReadUploadData ()
 schedules another data connection read if needed More...
 
void setReply (const int code, const char *msg)
 
void writeCustomReply (const int code, const char *msg, const HttpReply *reply=NULL)
 
void writeEarlyReply (const int code, const char *msg)
 
void writeErrorReply (const HttpReply *reply, const int status)
 writes FTP error response with given status and reply-derived error details More...
 
void writeForwardedForeign (const HttpReply *reply)
 
void writeForwardedReply (const HttpReply *reply)
 
void writeForwardedReplyAndCall (const HttpReply *reply, AsyncCall::Pointer &call)
 
void writeReply (MemBuf &mb)
 
Http::StreamearlyError (const EarlyErrorKind eek)
 creates a context filled with an error message for a given early error More...
 
bool handleRequest (HttpRequest *)
 
void setDataCommand ()
 
bool checkDataConnPre ()
 
bool handleFeatRequest (String &cmd, String &params)
 
bool handlePasvRequest (String &cmd, String &params)
 
bool handlePortRequest (String &cmd, String &params)
 
bool handleDataRequest (String &cmd, String &params)
 
bool handleUploadRequest (String &cmd, String &params)
 
bool handleEprtRequest (String &cmd, String &params)
 
bool handleEpsvRequest (String &cmd, String &params)
 
bool handleCwdRequest (String &cmd, String &params)
 
bool handlePassRequest (String &cmd, String &params)
 
bool handleCdupRequest (String &cmd, String &params)
 
void handleFeatReply (const HttpReply *header, StoreIOBuffer receivedData)
 
void handlePasvReply (const HttpReply *header, StoreIOBuffer receivedData)
 
void handlePortReply (const HttpReply *header, StoreIOBuffer receivedData)
 
void handleErrorReply (const HttpReply *header, StoreIOBuffer receivedData)
 
void handleDataReply (const HttpReply *header, StoreIOBuffer receivedData)
 
void handleUploadReply (const HttpReply *header, StoreIOBuffer receivedData)
 
void handleEprtReply (const HttpReply *header, StoreIOBuffer receivedData)
 
void handleEpsvReply (const HttpReply *header, StoreIOBuffer receivedData)
 
void startDechunkingRequest ()
 initialize dechunking state More...
 
void finishDechunkingRequest (bool withSuccess)
 put parsed content into input buffer and clean up More...
 
void abortChunkedRequestBody (const err_type error)
 quit on errors related to chunked request body handling More...
 
err_type handleChunkedRequestBody ()
 parses available chunked encoded body bytes, checks size, returns errors More...
 
void startPinnedConnectionMonitoring ()
 
void clientPinnedConnectionRead (const CommIoCbParams &io)
 
bool handleIdleClientPinnedTlsRead ()
 
void whenClientIpKnown ()
 
void doClientRead (const CommIoCbParams &io)
 
void clientWriteDone (const CommIoCbParams &io)
 
void deleteThis (const char *aReason)
 
void mustStop (const char *aReason)
 
bool done () const
 the job is destroyed in callEnd() when done() More...
 
virtual const char * status () const
 internal cleanup; do not call directly More...
 
void stopProducingFor (RefCount< BodyPipe > &, bool atEof)
 

Static Protected Member Functions

static void AcceptCtrlConnection (const CommAcceptCbParams &params)
 accept a new FTP control connection and hand it to a dedicated Server More...
 

Protected Attributes

BodyPipe::Pointer bodyPipe
 set when we are reading request body More...
 
AsyncCall::Pointer writer
 set when we are writing More...
 
const char * stopReason
 reason for forcing done() to be true More...
 
const char * typeName
 kid (leaf) class name, for debugging More...
 
AsyncCall::Pointer inCall
 the asynchronous call being handled, if any More...
 
const InstanceId< AsyncJobid
 job identifier More...
 

Private Member Functions

 CBDATA_CHILD (Server)
 
void doProcessRequest ()
 react to the freshly parsed request More...
 
void shovelUploadData ()
 shovel upload data from the internal buffer to the body pipe if possible More...
 
void resetLogin (const char *reason)
 clear client and server login-related state after the old login is gone More...
 

Private Attributes

SBuf uri
 a URI reconstructed from various FTP message details More...
 
SBuf host
 intended dest. of a transparently intercepted FTP conn More...
 
bool gotEpsvAll
 restrict data conn setup commands to just EPSV More...
 
AsyncCall::Pointer onDataAcceptCall
 who to call upon data conn acceptance More...
 
Comm::ConnectionPointer dataListenConn
 data connection listening socket More...
 
Comm::ConnectionPointer dataConn
 data connection More...
 
char uploadBuf [CLIENT_REQ_BUF_SZ]
 data connection input buffer More...
 
size_t uploadAvailSize
 number of yet unused uploadBuf bytes More...
 
AsyncCall::Pointer listener
 set when we are passively listening More...
 
AsyncCall::Pointer connector
 set when we are actively connecting More...
 
AsyncCall::Pointer reader
 set when we are reading FTP data More...
 
bool waitingForOrigin
 whether we wait for the origin data transfer to end More...
 
bool originDataDownloadAbortedOnError
 whether the origin data transfer aborted More...
 
HttpReply::Pointer delayedReply
 a response which writing was postponed until stopWaitingForOrigin() More...
 

Friends

void StartListening ()
 accept connections on all configured ftp_ports More...
 

Detailed Description

Definition at line 55 of file FtpServer.h.

Member Typedef Documentation

◆ Pointer [1/2]

Definition at line 25 of file BodyPipe.h.

◆ Pointer [2/2]

Definition at line 34 of file AsyncJob.h.

◆ ReplyHandler

typedef void(Ftp::Server::* Ftp::Server::ReplyHandler) (const HttpReply *reply, StoreIOBuffer data)
protected

Definition at line 166 of file FtpServer.h.

◆ RequestHandler

typedef bool(Ftp::Server::* Ftp::Server::RequestHandler) (String &cmd, String &params)
protected

Definition at line 153 of file FtpServer.h.

Member Enumeration Documentation

◆ EarlyErrorKind

enum Ftp::Server::EarlyErrorKind
strongprotected
Enumerator
HugeRequest 
MissingLogin 
MissingUsername 
MissingHost 
UnsupportedCommand 
InvalidUri 
MalformedCommand 

Definition at line 83 of file FtpServer.h.

Constructor & Destructor Documentation

◆ Server()

Server::Server ( const MasterXaction::Pointer xact)
explicit

Definition at line 52 of file FtpServer.cc.

References ConnStateData::flags, and uploadBuf.

Referenced by AcceptCtrlConnection().

◆ ~Server()

Server::~Server ( )
overridevirtual

Reimplemented from Server.

Definition at line 73 of file FtpServer.cc.

References closeDataConnection().

Member Function Documentation

◆ abortChunkedRequestBody()

◆ abortRequestParsing()

◆ AcceptCtrlConnection()

◆ acceptDataConnection()

◆ afterClientRead()

void ConnStateData::afterClientRead ( )
virtualinherited

Implements Server.

Definition at line 1953 of file client_side.cc.

References commIsHalfClosed(), debugs, fd_note(), and isOpen().

◆ afterClientWrite()

void ConnStateData::afterClientWrite ( size_t  )
virtualinherited

Reimplemented from Server.

Definition at line 996 of file client_side.cc.

References StatCounters::client_http, StatCounters::hit_kbytes_out, StatCounters::kbytes_out, size, and statCounter.

◆ borrowPinnedConnection()

Comm::ConnectionPointer ConnStateData::borrowPinnedConnection ( HttpRequest request)
inherited

◆ buildFakeRequest()

ClientHttpRequest * ConnStateData::buildFakeRequest ( Http::MethodType const  method,
SBuf useHost,
unsigned short  usePort,
const SBuf payload 
)
inherited

◆ buildSslCertGenerationParams()

void ConnStateData::buildSslCertGenerationParams ( Ssl::CertificateProperties certProperties)
inherited

Fill the certAdaptParams with the required data for certificate adaptation and create the key for storing/retrieve the certificate to/from the cache

Definition at line 2703 of file client_side.cc.

References Ssl::algSetCommonName, Ssl::algSetValidAfter, Ssl::algSetValidBefore, Ssl::algSignEnd, Ssl::algSignTrusted, Ssl::algSignUntrusted, assert, SBuf::c_str(), cbdataReference, SquidConfig::cert_adapt, SquidConfig::cert_sign, Ssl::CertAdaptAlgorithmStr, Server::clientConnection, Ssl::CertificateProperties::commonName, Config, Ssl::ServerBump::connectedOk(), dash_str, debugs, Ssl::DefaultSignHash, Security::LockingPointer< T, UnLocker, Locker >::get(), RefCount< C >::getRaw(), HERE(), SBuf::isEmpty(), Ssl::CertificateProperties::mimicCert, NULL, ConnStateData::port, Ssl::ServerBump::request, Security::LockingPointer< T, UnLocker, Locker >::resetAndLock(), Comm::Connection::rfc931, Ssl::ServerBump::serverCert, Ssl::CertificateProperties::setCommonName, Ssl::CertificateProperties::setValidAfter, Ssl::CertificateProperties::setValidBefore, Ssl::CertificateProperties::signAlgorithm, ConnStateData::signAlgorithm, Ssl::CertificateProperties::signHash, Ssl::CertificateProperties::signWithPkey, Ssl::CertificateProperties::signWithX509, SquidConfig::ssl_client, ConnStateData::sslCommonName_, ConnStateData::sslConnectHostOrIp, Ssl::ServerBump::sslErrors(), ACLFilledChecklist::sslErrors, ConnStateData::sslServerBump, and String::termedBuf().

Referenced by ConnStateData::getSslContextStart().

◆ calcUri()

void Server::calcUri ( const SBuf file)
protected

◆ callEnd()

void AsyncJob::callEnd ( )
virtualinherited

◆ callException()

void Server::callException ( const std::exception &  e)
overridevirtual

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)
inherited

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 101 of file AsyncJob.cc.

References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.

Referenced by AsyncJob::swanSong().

◆ CBDATA_CHILD()

Ftp::Server::CBDATA_CHILD ( Server  )
private

◆ changeState()

◆ checkDataConnPost()

bool Server::checkDataConnPost ( ) const
protected

Definition at line 1696 of file FtpServer.cc.

References dataConn, debugs, and Comm::IsConnOpen().

Referenced by handleDataReply(), handleUploadRequest(), and writeForwardedReplyAndCall().

◆ checkDataConnPre()

bool Server::checkDataConnPre ( )
protected

check that client data connection is ready for future I/O or at least has a chance of becoming ready soon.

Definition at line 1665 of file FtpServer.cc.

References Config, SquidConfig::connect, connectedForData(), connector, dataConn, dataListenConn, debugs, Ip::Address::isAnyAddr(), Comm::IsConnOpen(), JobCallback, Comm::Connection::remote, setReply(), AsyncJob::Start(), and SquidConfig::Timeout.

Referenced by handleDataRequest(), and handleUploadRequest().

◆ clientParseRequests()

bool ConnStateData::clientParseRequests ( )
inherited

Attempt to parse one or more requests from the input buffer. Returns true after completing parsing of at least one request [header]. That includes cases where parsing ended with an error (e.g., a huge request).

Definition at line 1892 of file client_side.cc.

References clientLifetimeTimeout, commCbCall(), commSetConnTimeout(), Config, debugs, HERE(), SquidConfig::lifetime, SquidConfig::maxRequestHeaderSize, Must, and SquidConfig::Timeout.

◆ clientPinnedConnectionClosed()

void Server::clientPinnedConnectionClosed ( const CommCloseCbParams io)
overrideprotectedvirtual

◆ clientPinnedConnectionRead()

void ConnStateData::clientPinnedConnectionRead ( const CommIoCbParams io)
protectedinherited

Our read handler called by Comm when the server either closes an idle pinned connection or perhaps unexpectedly sends something on that idle (from Squid p.o.v.) connection.

Definition at line 3853 of file client_side.cc.

References Server::clientConnection, Comm::Connection::close(), CommCommonCbParams::conn, debugs, Pipeline::empty(), Comm::ERR_CLOSING, CommCommonCbParams::flag, ConnStateData::handleIdleClientPinnedTlsRead(), Must, NULL, ConnStateData::pinning, Server::pipeline, and CommIoCbParams::size.

Referenced by ConnStateData::startPinnedConnectionMonitoring().

◆ clientReadFtpData()

void ConnStateData::clientReadFtpData ( const CommIoCbParams io)
inherited

◆ clientWriteDone()

void Server::clientWriteDone ( const CommIoCbParams io)
protectedinherited

callback handling the Comm::Write completion

Will call afterClientWrite(size_t) to sync the I/O state. Then writeSomeData() to initiate any followup writes that could be immediately done.

Definition at line 186 of file Server.cc.

References Server::afterClientWrite(), Server::clientConnection, CommCommonCbParams::conn, debugs, Comm::ERR_CLOSING, Comm::Connection::fd, CommCommonCbParams::flag, Pipeline::front(), Comm::IsConnOpen(), Must, Server::pipeline, CommIoCbParams::size, Server::writer, and Server::writeSomeData().

Referenced by Server::write().

◆ closeDataConnection()

◆ completeDataDownload()

void Server::completeDataDownload ( )
protected

Writes the data-transfer status reply to the FTP client and closes the data connection.

Definition at line 1835 of file FtpServer.cc.

References closeDataConnection(), master, and writeCustomReply().

Referenced by stopWaitingForOrigin(), and userDataCompletionCheckpoint().

◆ connectedForData()

◆ connStateClosed()

void ConnStateData::connStateClosed ( const CommCloseCbParams io)
inherited

Definition at line 495 of file client_side.cc.

Referenced by ConnStateData::start().

◆ consumeInput()

void ConnStateData::consumeInput ( const size_t  byteCount)
inherited

Definition at line 1444 of file client_side.cc.

References assert, and debugs.

Referenced by parseHttpRequest(), and parseOneRequest().

◆ createDataConnection()

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)
protectedinherited

◆ doClientRead()

◆ done()

◆ doneAll()

virtual bool ConnStateData::doneAll ( ) const
inlinevirtualinherited

Reimplemented from Server.

Definition at line 212 of file client_side.h.

References data, AsyncJob::doneAll(), and request().

◆ doneWithControlMsg()

void ConnStateData::doneWithControlMsg ( )
virtualinherited

◆ doPeekAndSpliceStep()

void ConnStateData::doPeekAndSpliceStep ( )
inherited

Called when a peek-and-splice step finished. For example after server SSL certificates received and fake server SSL certificates generated

Definition at line 3151 of file client_side.cc.

References assert, BIO_get_data(), Server::clientConnection, clientNegotiateSSL(), COMM_SELECT_WRITE, debugs, Comm::Connection::fd, fd_table, Ssl::ClientBio::hold(), Comm::SetSelect(), and ConnStateData::switchedToHttps_.

Referenced by ConnStateData::getSslContextStart(), and ConnStateData::sslCrtdHandleReply().

◆ doProcessRequest()

◆ earlyError()

◆ endingShutdown()

void ConnStateData::endingShutdown ( )
virtualinherited

Called after shutdown_lifetime grace period ends and before stopping the main loop. At least one main loop iteration is guaranteed after this call. Meant for cleanup and state saving that may require other modules.

Reimplemented from RegisteredRunner.

Definition at line 1038 of file client_side.cc.

References Comm::IsConnOpen().

◆ expectNoForwarding()

void ConnStateData::expectNoForwarding ( )
inherited

◆ expectRequestBody()

BodyPipe::Pointer ConnStateData::expectRequestBody ( int64_t  size)
inherited

◆ fakeAConnectRequest()

◆ finishDechunkingRequest()

void ConnStateData::finishDechunkingRequest ( bool  withSuccess)
protectedinherited

◆ getAuth()

const Auth::UserRequest::Pointer& ConnStateData::getAuth ( ) const
inlineinherited

Fetch the user details for connection based authentication NOTE: this is ONLY connection based because NTLM and Negotiate is against HTTP spec.

Definition at line 115 of file client_side.h.

Referenced by Auth::UserRequest::authenticate(), AuthenticateAcl(), authTryGetUser(), ConnStateData::buildFakeRequest(), ClientHttpRequest::calloutsError(), clientProcessRequest(), and constructHelperQuery().

◆ getSslContextDone()

◆ getSslContextStart()

◆ handleCdupRequest()

bool Server::handleCdupRequest ( String cmd,
String params 
)
protected

Definition at line 1639 of file FtpServer.cc.

References changeState(), and Ftp::fssHandleCdup.

Referenced by handleRequest().

◆ handleChunkedRequestBody()

err_type ConnStateData::handleChunkedRequestBody ( )
protectedinherited

◆ handleCwdRequest()

bool Server::handleCwdRequest ( String cmd,
String params 
)
protected

Definition at line 1625 of file FtpServer.cc.

References changeState(), and Ftp::fssHandleCwd.

Referenced by handleRequest().

◆ handleDataReply()

◆ handleDataRequest()

bool Server::handleDataRequest ( String cmd,
String params 
)
protected

◆ handleEprtReply()

void Server::handleEprtReply ( const HttpReply header,
StoreIOBuffer  receivedData 
)
protected

Definition at line 1061 of file FtpServer.cc.

References ERR_NONE, Pipeline::front(), Server::pipeline, and writeCustomReply().

Referenced by handleReply().

◆ handleEprtRequest()

bool Server::handleEprtRequest ( String cmd,
String params 
)
protected

◆ handleEpsvReply()

void Server::handleEpsvReply ( const HttpReply header,
StoreIOBuffer  receivedData 
)
protected

◆ handleEpsvRequest()

bool Server::handleEpsvRequest ( String cmd,
String params 
)
protected

◆ handleErrorReply()

void Server::handleErrorReply ( const HttpReply header,
StoreIOBuffer  receivedData 
)
protected

Definition at line 936 of file FtpServer.cc.

References SBuf::clear(), ConnStateData::pinning, uri, and writeErrorReply().

Referenced by handleReply().

◆ handleFeatReply()

◆ handleFeatRequest()

bool Server::handleFeatRequest ( String cmd,
String params 
)
protected

Definition at line 1410 of file FtpServer.cc.

References changeState(), and Ftp::fssHandleFeat.

Referenced by handleRequest().

◆ handleIdleClientPinnedTlsRead()

bool ConnStateData::handleIdleClientPinnedTlsRead ( )
protectedinherited

Handles a ready-for-reading TLS squid-to-server connection that we thought was idle.

Returns
false if and only if the connection should be closed.

Definition at line 3812 of file client_side.cc.

References buf, DBG_IMPORTANT, debugs, error(), fd_table, Must, ConnStateData::pinning, and ConnStateData::startPinnedConnectionMonitoring().

Referenced by ConnStateData::clientPinnedConnectionRead().

◆ handlePassRequest()

bool Server::handlePassRequest ( String cmd,
String params 
)
protected

Definition at line 1632 of file FtpServer.cc.

References changeState(), and Ftp::fssHandlePass.

Referenced by handleRequest().

◆ handlePasvReply()

◆ handlePasvRequest()

bool Server::handlePasvRequest ( String cmd,
String params 
)
protected

Definition at line 1417 of file FtpServer.cc.

References changeState(), Ftp::fssHandlePasv, gotEpsvAll, setReply(), and String::size().

Referenced by handleRequest().

◆ handlePortReply()

void Server::handlePortReply ( const HttpReply header,
StoreIOBuffer  receivedData 
)
protected

Definition at line 923 of file FtpServer.cc.

References ERR_NONE, Pipeline::front(), Server::pipeline, and writeCustomReply().

Referenced by handleReply().

◆ handlePortRequest()

bool Server::handlePortRequest ( String cmd,
String params 
)
protected

◆ handleReadData()

bool ConnStateData::handleReadData ( )
virtualinherited

called when new request data has been read from the socket

Return values
falsecalled comm_close or setReplyToError (the caller should bail)
truewe did not call comm_close or setReplyToError

Implements Server.

Definition at line 1997 of file client_side.cc.

References NULL.

◆ handleReply()

void Server::handleReply ( HttpReply header,
StoreIOBuffer  receivedData 
)
overrideprotectedvirtual

◆ handleRequest()

◆ handleRequestBodyData()

bool ConnStateData::handleRequestBodyData ( )
inherited

called when new request body data has been buffered in inBuf may close the connection if we were closing and piped everything out

Return values
falsecalled comm_close or setReplyToError (the caller should bail)
truewe did not call comm_close or setReplyToError

Definition at line 2013 of file client_side.cc.

References assert, debugs, error(), HERE(), and NULL.

Referenced by clientProcessRequest(), and Http::One::Server::noteMoreBodySpaceAvailable().

◆ handleUploadReply()

void Server::handleUploadReply ( const HttpReply header,
StoreIOBuffer  receivedData 
)
protected

Definition at line 1031 of file FtpServer.cc.

References writeForwardedReply().

Referenced by handleReply().

◆ handleUploadRequest()

◆ handleUserRequest()

Http::Stream * Server::handleUserRequest ( const SBuf cmd,
SBuf params 
)
protected

Called to parse USER command, which is required to create an HTTP request wrapper. W/o request, the errors are handled by returning earlyError().

Definition at line 1362 of file FtpServer.cc.

References SBuf::c_str(), calcUri(), SBuf::caseCmp(), SBuf::chop(), closeDataConnection(), debugs, earlyError(), SBuf::find(), host, SBuf::isEmpty(), SBuf::length(), master, MAX_IPSTRLEN, MissingHost, MissingUsername, SBuf::npos, NULL, resetLogin(), SBuf::rfind(), SBuf::substr(), Ip::Address::toHostStr(), ConnStateData::unpinConnection(), and uri.

Referenced by parseOneRequest().

◆ hasNotes()

bool ConnStateData::hasNotes ( ) const
inlineinherited

Definition at line 321 of file client_side.h.

Referenced by Http::One::Server::buildHttpRequest().

◆ httpsPeeked()

◆ idleTimeout()

time_t Server::idleTimeout ( ) const
overrideprotectedvirtual

Implements ConnStateData.

Definition at line 85 of file FtpServer.cc.

References Config, SquidConfig::ftpClientIdle, and SquidConfig::Timeout.

◆ initiateTunneledRequest()

◆ isOpen()

◆ kick()

void ConnStateData::kick ( )
inherited
We are done with the response, and we are either still receiving request body (early response!) or have already stopped receiving anything.

If we are still receiving, then clientParseRequest() below will fail. (XXX: but then we will call readNextRequest() which may succeed and execute a smuggled request as we are not done with the current request).

If we stopped because we got everything, then try the next request.

If we stopped receiving because of an error, then close now to avoid getting stuck and to prevent accidental request smuggling.

Attempt to parse a request from the request buffer. If we've been fed a pipelined request it may already be in our read buffer.
This needs to fall through - if we're unlucky and parse the last request from our read buffer we may never re-register for another client read.
Either we need to kick-start another read or, if we have a half-closed connection, kill it after the last request. This saves waiting for half-closed connections to finished being half-closed AND then, sometimes, spending "Timeout" time in the keepalive "Waiting for next request" state.
At this point we either have a parsed request (which we've kicked off the processing for) or not. If we have a deferred request (parsed but deferred for pipeling processing reasons) then look at processing it. If not, simply kickstart another read.

Definition at line 891 of file client_side.cc.

References ClientSocketContextPushDeferredIfNeeded(), commIsHalfClosed(), DBG_IMPORTANT, debugs, Comm::IsConnOpen(), and MYNAME.

Referenced by ConnStateData::notePinnedConnectionBecameIdle(), Http::Stream::writeComplete(), and wroteReply().

◆ listenForDataConnection()

◆ maybeMakeSpaceAvailable()

void Server::maybeMakeSpaceAvailable ( )
inherited

Prepare inBuf for I/O. This method balances several conflicting desires:

  1. Do not read too few bytes at a time.
  2. Do not waste too much buffer space.
  3. Do not [re]allocate or memmove the buffer too much.
  4. Obey Config.maxRequestBufferSize limit.

Definition at line 70 of file Server.cc.

References SBufReservationRequirements::allowShared, CLIENT_REQ_BUF_SZ, Config, debugs, SBufReservationRequirements::idealSpace, Server::inBuf, SBufReservationRequirements::maxCapacity, SquidConfig::maxRequestBufferSize, SBufReservationRequirements::minSpace, SBuf::reserve(), and SBuf::spaceSize().

Referenced by Server::doClientRead(), and Server::writing().

◆ maybeReadUploadData()

void Server::maybeReadUploadData ( )
protected

◆ mayNeedToReadMoreBody()

int64_t ConnStateData::mayNeedToReadMoreBody ( ) const
inherited

number of body bytes we need to comm_read for the "current" request

Return values
0We do not need to read any [more] body bytes
negativeMay need more but do not know how many; could be zero!
positiveNeed to read exactly that many more body bytes

Definition at line 3584 of file client_side.cc.

References ConnStateData::bodyPipe, BodyPipe::bodySizeKnown(), Server::inBuf, SBuf::length(), and BodyPipe::unproducedSize().

◆ mayTunnelUnsupportedProto()

◆ mustStop()

void AsyncJob::mustStop ( const char *  aReason)
protectedinherited

Definition at line 69 of file AsyncJob.cc.

References debugs, AsyncJob::inCall, Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.

Referenced by HttpStateData::abortAll(), Ftp::Client::abortAll(), Comm::TcpAcceptor::acceptOne(), Adaptation::Ecap::XactionRep::adaptationAborted(), Adaptation::AccessCheck::callBack(), AsyncJob::callException(), Security::PeerConnector::connectionClosed(), HttpStateData::continueAfterParsingHeader(), Ftp::Client::ctrlClosed(), Adaptation::Iterator::handleAdaptationBlock(), Adaptation::Iterator::handleAdaptationError(), Log::TcpLogger::handleClosure(), Adaptation::Icap::Xaction::handleCommClosed(), Http::Tunneler::handleConnectionClosure(), Mgr::Forwarder::handleError(), Ipc::Forwarder::handleError(), Ipc::Forwarder::handleException(), Ipc::Inquirer::handleException(), HttpStateData::handleMoreRequestBodyAvailable(), Ipc::Inquirer::handleRemoteAck(), Ipc::Forwarder::handleTimeout(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), Comm::ConnOpener::noteAbort(), Adaptation::Icap::ModXact::noteBodyConsumerAborted(), Snmp::Forwarder::noteCommClosed(), Snmp::Inquirer::noteCommClosed(), Mgr::Inquirer::noteCommClosed(), Mgr::Forwarder::noteCommClosed(), Mgr::StoreToCommWriter::noteCommClosed(), Adaptation::Icap::Xaction::noteCommRead(), Rock::HeaderUpdater::noteDoneReading(), Adaptation::Iterator::noteInitiatorAborted(), Adaptation::Icap::Xaction::noteInitiatorAborted(), Adaptation::Ecap::XactionRep::noteInitiatorAborted(), HttpStateData::readReply(), Comm::ConnOpener::sendAnswer(), Rock::Rebuild::start(), Security::PeerConnector::start(), HttpStateData::start(), Ipc::UdsSender::timedout(), and HttpStateData::wroteLast().

◆ noteBodyConsumerAborted()

void Server::noteBodyConsumerAborted ( BodyPipe::Pointer  ptr)
overrideprotectedvirtual

◆ noteMoreBodySpaceAvailable()

void Server::noteMoreBodySpaceAvailable ( BodyPipe::Pointer  )
overrideprotectedvirtual

Implements ConnStateData.

Definition at line 221 of file FtpServer.cc.

References ConnStateData::isOpen(), and shovelUploadData().

◆ notePeerConnection()

void Server::notePeerConnection ( Comm::ConnectionPointer  )
overrideprotectedvirtual

◆ notePinnedConnectionBecameIdle()

◆ notes()

NotePairs::Pointer ConnStateData::notes ( )
inherited
Returns
existing non-empty connection annotations, creates and returns empty annotations otherwise

Definition at line 3986 of file client_side.cc.

References ConnStateData::theNotes.

Referenced by Http::One::Server::buildHttpRequest(), and UpdateRequestNotes().

◆ parseOneRequest()

Http::Stream * Server::parseOneRequest ( )
overrideprotectedvirtual

Parses a single FTP request on the control connection. Returns a new Http::Stream on valid requests and all errors. Returns NULL on incomplete requests that may still succeed given more data.

Implements ConnStateData.

Definition at line 635 of file FtpServer.cc.

References SBuf::c_str(), RequestFlags::cachable, calcUri(), changeState(), SBuf::clear(), ClientHttpRequest::client_stream, Server::clientConnection, clientGetMoreData, clientReplyDetach, clientReplyStatus, clientSocketDetach, clientSocketRecipient, clientStreamInit(), Ftp::cmdAppe(), Ftp::cmdStor(), Ftp::cmdStou(), Ftp::cmdUser(), Ftp::CommandHasPathParameter(), CharacterSet::complement(), Config, ConnStateData::consumeInput(), StoreIOBuffer::data, debugs, earlyError(), Http::EXPECT, ConnStateData::flags, Http::Stream::flags, HttpRequest::flags, HttpRequest::FromUrl(), Ftp::fssError, Http::FTP_ARGUMENTS, Http::FTP_COMMAND, RequestFlags::ftpNative, handleUserRequest(), Http::Message::header, HTTP_REQBUF_SZ, Http::Message::http_ver, HugeRequest, Server::inBuf, XactionInitiator::initClient, ClientHttpRequest::initRequest(), InvalidUri, SBuf::isEmpty(), StoreIOBuffer::length, SBuf::length(), CharacterSet::LF, master, SquidConfig::maxRequestHeaderSize, method, Http::METHOD_GET, Http::METHOD_PUT, min(), MissingLogin, Must, RequestFlags::noCache, NULL, Http::Stream::parsed_ok, Parser::Tokenizer::parsedSize(), ConnStateData::pinning, Parser::Tokenizer::prefix(), Http::ProtocolVersion(), Ftp::ProtocolVersion(), HttpHeader::putStr(), ConnStateData::quitAfterError(), ClientHttpRequest::req_sz, Http::Stream::reqbuf, request(), Parser::Tokenizer::skipAll(), Ftp::SupportedCommand(), MasterXaction::tcpClient, SBuf::toUpper(), Http::TRANSFER_ENCODING, ConnStateData::transparent(), SBuf::trim(), UnsupportedCommand, ClientHttpRequest::uri, uri, and xstrdup.

◆ parseTlsHandshake()

◆ pinBusyConnection()

void ConnStateData::pinBusyConnection ( const Comm::ConnectionPointer pinServerConn,
const HttpRequest::Pointer request 
)
inherited

Forward future client requests using the given to-server connection. The connection is still being used by the current client request.

Definition at line 3724 of file client_side.cc.

References ConnStateData::pinConnection().

Referenced by notePeerConnection().

◆ pinnedAuth()

bool ConnStateData::pinnedAuth ( ) const
inlineinherited

Definition at line 197 of file client_side.h.

◆ pinnedPeer()

CachePeer* ConnStateData::pinnedPeer ( ) const
inlineinherited

returts the pinned CachePeer if exists, NULL otherwise

Definition at line 196 of file client_side.h.

◆ pipelinePrefetchMax()

int Server::pipelinePrefetchMax ( ) const
overrideprotectedvirtual

Reimplemented from ConnStateData.

Definition at line 79 of file FtpServer.cc.

◆ postHttpsAccept()

◆ prepareTlsSwitchingURL()

char * ConnStateData::prepareTlsSwitchingURL ( const Http1::RequestParserPointer hp)
inherited

◆ processParsedRequest()

void Server::processParsedRequest ( Http::StreamPointer )
overrideprotectedvirtual

Implements ConnStateData.

Definition at line 155 of file FtpServer.cc.

References CallJobHere, Pipeline::count(), doProcessRequest(), Must, and Server::pipeline.

◆ proxyProtocolHeader()

const ProxyProtocol::HeaderPointer& ConnStateData::proxyProtocolHeader ( ) const
inlineinherited

Definition at line 323 of file client_side.h.

Referenced by ClientHttpRequest::ClientHttpRequest().

◆ quitAfterError()

void ConnStateData::quitAfterError ( HttpRequest request)
inherited

Changes state so that we close the connection and quit after serving the client-side-detected error response instead of getting stuck.

Definition at line 1466 of file client_side.cc.

References debugs, HttpRequest::flags, HERE(), and RequestFlags::proxyKeepalive.

Referenced by clientProcessRequest(), parseOneRequest(), Http::One::Server::processParsedRequest(), and Http::One::Server::setReplyError().

◆ reading()

bool Server::reading ( ) const
inlineinherited

◆ readNextRequest()

void ConnStateData::readNextRequest ( )
inherited

Set the timeout BEFORE calling readSomeData().

Please don't do anything with the FD past here!

Definition at line 851 of file client_side.cc.

References commSetConnTimeout(), debugs, fd_note(), HERE(), JobCallback, and ConnStateData::requestTimeout().

◆ readSomeData()

◆ readUploadData()

◆ receivedFirstByte()

void ConnStateData::receivedFirstByte ( )
virtualinherited

◆ replyDataWritingCheckpoint()

void Server::replyDataWritingCheckpoint ( )
protected

◆ requestTimeout()

◆ resetLogin()

void Server::resetLogin ( const char *  reason)
private

Definition at line 331 of file FtpServer.cc.

References changeState(), debugs, Ftp::fssBegin, and master.

Referenced by handleUserRequest().

◆ resetSslCommonName()

void ConnStateData::resetSslCommonName ( const char *  name)
inlineinherited

◆ sendControlMsg()

◆ serveDelayedError()

◆ serverBump()

◆ setAuth()

void ConnStateData::setAuth ( const Auth::UserRequest::Pointer aur,
const char *  cause 
)
inherited

Set the user details for connection-based authentication to use from now until connection closure.

Any change to existing credentials shows that something invalid has happened. Such as:

  • NTLM/Negotiate auth was violated by the per-request headers missing a revalidation token
  • NTLM/Negotiate auth was violated by the per-request headers being for another user
  • SSL-Bump CONNECT tunnel with persistent credentials has ended

Definition at line 502 of file client_side.cc.

References comm_reset_close(), debugs, and NULL.

Referenced by Auth::UserRequest::authenticate(), ProxyAuthLookup::LookupDone(), and ClientHttpRequest::sslBumpEstablish().

◆ setDataCommand()

◆ setReply()

◆ setServerBump()

void ConnStateData::setServerBump ( Ssl::ServerBump srvBump)
inlineinherited

Definition at line 254 of file client_side.h.

References assert.

Referenced by ClientHttpRequest::doCallouts().

◆ shovelUploadData()

◆ splice()

◆ sslCommonName()

const SBuf& ConnStateData::sslCommonName ( ) const
inlineinherited

Definition at line 260 of file client_side.h.

◆ sslCrtdHandleReply()

◆ sslCrtdHandleReplyWrapper()

void ConnStateData::sslCrtdHandleReplyWrapper ( void *  data,
const Helper::Reply reply 
)
staticinherited

Definition at line 2653 of file client_side.cc.

References ConnStateData::sslCrtdHandleReply().

Referenced by ConnStateData::getSslContextStart().

◆ Start()

◆ start()

void Server::start ( )
overrideprotectedvirtual

◆ startDechunkingRequest()

void ConnStateData::startDechunkingRequest ( )
protectedinherited

◆ startPeekAndSplice()

◆ startPinnedConnectionMonitoring()

void ConnStateData::startPinnedConnectionMonitoring ( )
protectedinherited

[re]start monitoring pinned connection for peer closures so that we can propagate them to an idle client pinned to that peer

Definition at line 3790 of file client_side.cc.

References ConnStateData::clientPinnedConnectionRead(), JobCallback, NULL, ConnStateData::pinning, and Comm::Read().

Referenced by ConnStateData::handleIdleClientPinnedTlsRead(), and ConnStateData::notePinnedConnectionBecameIdle().

◆ startShutdown()

void ConnStateData::startShutdown ( )
virtualinherited

Called after receiving a shutdown request and before stopping the main loop. At least one main loop iteration is guaranteed after this call. Meant for cleanup and state saving that may require other modules.

Reimplemented from RegisteredRunner.

Definition at line 1027 of file client_side.cc.

◆ startWaitingForOrigin()

void Server::startWaitingForOrigin ( )

Called by Ftp::Client class when it is start receiving or sending data.

Definition at line 1762 of file FtpServer.cc.

References debugs, ConnStateData::isOpen(), and waitingForOrigin.

Referenced by Ftp::Relay::sendCommand().

◆ status()

◆ stoppedReceiving()

const char* ConnStateData::stoppedReceiving ( ) const
inlineinherited

◆ stoppedSending()

const char* ConnStateData::stoppedSending ( ) const
inlineinherited

Definition at line 152 of file client_side.h.

References error(), and size.

Referenced by ConnStateData::stopReceiving().

◆ stopPinnedConnectionMonitoring()

void ConnStateData::stopPinnedConnectionMonitoring ( )
inherited

◆ stopProducingFor()

◆ stopReading()

void Server::stopReading ( )
inherited

◆ stopReceiving()

◆ stopSending()

void ConnStateData::stopSending ( const char *  error)
inherited

Definition at line 972 of file client_side.cc.

References debugs, error(), and HERE().

Referenced by Http::Stream::initiateClose().

◆ stopWaitingForOrigin()

void Server::stopWaitingForOrigin ( int  status)

Called by Ftp::Client class when it is done receiving or sending data. Waits for both agents to be done before responding to the FTP client and closing the data connection.

Definition at line 1772 of file FtpServer.cc.

References completeDataDownload(), debugs, delayedReply, Ftp::fssHandleDataRequest, RefCount< C >::getRaw(), ConnStateData::isOpen(), master, Must, originDataDownloadAbortedOnError, waitingForOrigin, and writeForwardedReply().

Referenced by Ftp::Relay::stopOriginWait().

◆ swanSong()

void ConnStateData::swanSong ( )
virtualinherited

Reimplemented from Server.

Definition at line 583 of file client_side.cc.

References clientdbEstablished(), debugs, HERE(), NULL, and Server::swanSong().

◆ switchedToHttps()

bool ConnStateData::switchedToHttps ( ) const
inlineinherited

◆ switchToHttps()

◆ tlsClientSni()

const SBuf& ConnStateData::tlsClientSni ( ) const
inlineinherited

Definition at line 262 of file client_side.h.

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

◆ transparent()

◆ unpinConnection()

◆ userDataCompletionCheckpoint()

void Server::userDataCompletionCheckpoint ( int  finalStatusCode)
protected

Called after data trasfer on client-to-squid data connection is finished.

Definition at line 1810 of file FtpServer.cc.

References ConnStateData::bodyParser, completeDataDownload(), debugs, ConnStateData::finishDechunkingRequest(), master, Must, originDataDownloadAbortedOnError, and waitingForOrigin.

Referenced by replyDataWritingCheckpoint(), and wroteReplyData().

◆ validatePinnedConnection()

const Comm::ConnectionPointer ConnStateData::validatePinnedConnection ( HttpRequest request)
inherited

Checks if there is pinning info if it is valid. It can close the server side connection if pinned info is not valid.

Parameters
requestif it is not NULL also checks if the pinning info refers to the request client side HttpRequest
Returns
The details of the server side connection (may be closed if failures were present).

Definition at line 3882 of file client_side.cc.

References cbdataReferenceValid(), debugs, HERE(), AnyP::Uri::host(), Comm::IsConnOpen(), ConnStateData::pinning, AnyP::Uri::port(), ConnStateData::unpinConnection(), and HttpRequest::url.

Referenced by ConnStateData::borrowPinnedConnection().

◆ whenClientIpKnown()

◆ write() [1/2]

void Server::write ( MemBuf mb)
inlineinherited

◆ write() [2/2]

void Server::write ( char *  buf,
int  len 
)
inlineinherited

◆ writeControlMsgAndCall()

bool Server::writeControlMsgAndCall ( HttpReply rep,
AsyncCall::Pointer call 
)
overrideprotectedvirtual

Implements ConnStateData.

Definition at line 1156 of file FtpServer.cc.

References writeForwardedReplyAndCall().

◆ writeCustomReply()

◆ writeEarlyReply()

void Server::writeEarlyReply ( const int  code,
const char *  msg 
)
protected

Writes FTP [error] response before we fully parsed the FTP request and created the corresponding HTTP request wrapper for that FTP request.

Definition at line 471 of file FtpServer.cc.

References Packable::appendf(), assert, Server::clientConnection, debugs, ConnStateData::flags, MemBuf::init(), JobCallback, Comm::Write(), and wroteEarlyReply().

Referenced by handleUploadRequest(), and start().

◆ writeErrorReply()

◆ writeForwardedForeign()

void Server::writeForwardedForeign ( const HttpReply reply)
protected

writes FTP response based on HTTP reply that is not an FTP-response wrapper for example, internally-generated Squid "errorpages" end up here (for now)

Definition at line 1147 of file FtpServer.cc.

References changeState(), closeDataConnection(), Ftp::fssConnected, and writeErrorReply().

Referenced by writeForwardedReply().

◆ writeForwardedReply()

◆ writeForwardedReplyAndCall()

◆ writeReply()

void Server::writeReply ( MemBuf mb)
protected

◆ writeSomeData()

virtual void Server::writeSomeData ( )
inlinevirtualinherited

Definition at line 66 of file Server.h.

Referenced by Server::clientWriteDone().

◆ writing()

bool Server::writing ( ) const
inlineinherited

Definition at line 86 of file Server.h.

References Server::maybeMakeSpaceAvailable(), NULL, and Server::writer.

◆ wroteControlMsg()

void HttpControlMsgSink::wroteControlMsg ( const CommIoCbParams params)
inherited

◆ wroteEarlyReply()

◆ wroteReply()

◆ wroteReplyData()

Friends And Related Function Documentation

◆ StartListening

void StartListening ( )
friend

Member Data Documentation

◆ auth

bool ConnStateData::auth
inherited

Definition at line 139 of file client_side.h.

Referenced by clientCheckPinning().

◆ bodyParser

◆ bodyPipe

◆ cbControlMsgSent

AsyncCall::Pointer HttpControlMsgSink::cbControlMsgSent
inherited

◆ clientConnection

Comm::ConnectionPointer Server::clientConnection
inherited

Definition at line 97 of file Server.h.

Referenced by acceptDataConnection(), Format::Format::assemble(), Auth::UserRequest::authenticate(), ConnStateData::buildFakeRequest(), Http::One::Server::buildHttpRequest(), ConnStateData::buildSslCertGenerationParams(), callException(), ClientHttpRequest::calloutsError(), IdentLookup::checkForAsync(), clientAclChecklistFill(), ClientHttpRequest::ClientHttpRequest(), clientIdentDone(), clientNegotiateSSL(), clientPinnedConnectionClosed(), ConnStateData::clientPinnedConnectionClosed(), ConnStateData::clientPinnedConnectionRead(), clientProcessRequest(), clientProcessRequestFinished(), ClientSocketContextPushDeferredIfNeeded(), clientSocketRecipient(), clientTunnelOnError(), Server::clientWriteDone(), constructHelperQuery(), createDataConnection(), ClientHttpRequest::doCallouts(), Server::doClientRead(), Server::doneAll(), ConnStateData::doneWithControlMsg(), ConnStateData::doPeekAndSpliceStep(), ESIContext::fail(), ConnStateData::fakeAConnectRequest(), ConnStateData::getSslContextDone(), ConnStateData::getSslContextStart(), handlePasvReply(), handleRequest(), httpsCreate(), httpsEstablish(), httpsSslBumpAccessCheckDone(), httpsSslBumpStep2AccessCheckDone(), listenForDataConnection(), IdentLookup::LookupDone(), HttpRequest::manager(), ACLIdent::match(), ClientHttpRequest::noteAdaptationAclCheckDone(), ClientHttpRequest::noteBodyProducerAborted(), parseHttpRequest(), parseOneRequest(), ConnStateData::parseTlsHandshake(), ConnStateData::pinConnection(), ConnStateData::postHttpsAccept(), prepareAcceleratedURL(), prepareTransparentURL(), clientReplyContext::processExpired(), clientReplyContext::processMiss(), clientReplyContext::processOnlyIfCachedMiss(), Http::One::Server::processParsedRequest(), clientReplyContext::processReplyAccessResult(), clientReplyContext::purgeFoundObject(), clientReplyContext::purgeRequest(), Server::readSomeData(), PeerSelector::resolveSelected(), clientReplyContext::sendBodyTooLargeError(), ConnStateData::sendControlMsg(), clientReplyContext::sendPreconditionFailedError(), Http::One::Server::setReplyError(), shovelUploadData(), ConnStateData::splice(), ClientHttpRequest::sslBumpEstablish(), ClientHttpRequest::sslBumpStart(), ConnStateData::sslCrtdHandleReply(), Http::One::Server::start(), start(), ConnStateData::start(), ConnStateData::startPeekAndSplice(), statClientRequests(), Server::stopReading(), ConnStateData::stopReceiving(), ConnStateData::storeTlsContextToCache(), Server::swanSong(), ConnStateData::switchToHttps(), tlsAttemptHandshake(), ConnStateData::transparent(), tunnelStart(), TunnelStateData::TunnelStateData(), ConnStateData::whenClientIpKnown(), Server::write(), Http::One::Server::writeControlMsgAndCall(), writeEarlyReply(), writeForwardedReplyAndCall(), and writeReply().

◆ closeHandler

AsyncCall::Pointer ConnStateData::closeHandler
inherited

Definition at line 144 of file client_side.h.

◆ connector

AsyncCall::Pointer Ftp::Server::connector
private

Definition at line 191 of file FtpServer.h.

Referenced by checkDataConnPre(), and connectedForData().

◆ dataConn

◆ dataListenConn

◆ delayedReply

HttpReply::Pointer Ftp::Server::delayedReply
private

Definition at line 200 of file FtpServer.h.

Referenced by stopWaitingForOrigin(), and writeForwardedReply().

◆ flags

◆ gotEpsvAll

bool Ftp::Server::gotEpsvAll
private

◆ host

SBuf Ftp::Server::host
private

Definition at line 182 of file FtpServer.h.

Referenced by calcUri(), handleUserRequest(), and start().

◆ id

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 72 of file AsyncJob.h.

◆ inBuf

◆ inCall

◆ listener

AsyncCall::Pointer Ftp::Server::listener
private

Definition at line 190 of file FtpServer.h.

Referenced by closeDataConnection(), and listenForDataConnection().

◆ log_addr

Ip::Address ConnStateData::log_addr
inherited

◆ master

◆ onDataAcceptCall

AsyncCall::Pointer Ftp::Server::onDataAcceptCall
private

◆ originDataDownloadAbortedOnError

bool Ftp::Server::originDataDownloadAbortedOnError
private

◆ peer

CachePeer* ConnStateData::peer
inherited

Definition at line 142 of file client_side.h.

Referenced by clientHttpRequestStatus().

◆ pinned

bool ConnStateData::pinned
inherited

Definition at line 138 of file client_side.h.

Referenced by HttpRequest::pinnedConnection().

◆ pinning

◆ pipeline

◆ port

◆ preservedClientData

SBuf ConnStateData::preservedClientData
inherited

client data which may need to forward as-is to server after an on_unsupported_protocol tunnel decision.

Definition at line 312 of file client_side.h.

Referenced by Format::Format::assemble(), clientTunnelOnError(), parseHttpRequest(), ConnStateData::parseTlsHandshake(), and ConnStateData::splice().

◆ reader

AsyncCall::Pointer Ftp::Server::reader
private

Definition at line 192 of file FtpServer.h.

Referenced by closeDataConnection(), maybeReadUploadData(), and readUploadData().

◆ readHandler

AsyncCall::Pointer ConnStateData::readHandler
inherited

Definition at line 143 of file client_side.h.

◆ reading

bool ConnStateData::reading
inherited

Definition at line 140 of file client_side.h.

◆ readMore

bool ConnStateData::readMore
inherited

◆ receivedFirstByte_

bool Server::receivedFirstByte_
inherited

Definition at line 112 of file Server.h.

Referenced by Server::doClientRead(), and ConnStateData::switchToHttps().

◆ serverConnection

Comm::ConnectionPointer ConnStateData::serverConnection
inherited

Definition at line 135 of file client_side.h.

Referenced by clientCheckPinning().

◆ sslBumpMode

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ swanSang

bool ConnStateData::swanSang
inherited

Definition at line 132 of file client_side.h.

◆ tlsParser

Security::HandshakeParser ConnStateData::tlsParser
inherited

Tls parser to use for client HELLO messages parsing on bumped connections.

Definition at line 276 of file client_side.h.

Referenced by ConnStateData::parseTlsHandshake().

◆ transferProtocol

AnyP::ProtocolVersion Server::transferProtocol
inherited

The transfer protocol currently being spoken on this connection. HTTP/1.x CONNECT, HTTP/1.1 Upgrade and HTTP/2 SETTINGS offer the ability to change protocols on the fly.

Definition at line 104 of file Server.h.

Referenced by buildUrlFromHost(), parseHttpRequest(), prepareAcceleratedURL(), prepareTransparentURL(), ConnStateData::splice(), and ConnStateData::switchToHttps().

◆ typeName

◆ uploadAvailSize

size_t Ftp::Server::uploadAvailSize
private

◆ uploadBuf

char Ftp::Server::uploadBuf[CLIENT_REQ_BUF_SZ]
private

Definition at line 187 of file FtpServer.h.

Referenced by maybeReadUploadData(), readUploadData(), Server(), and shovelUploadData().

◆ uri

SBuf Ftp::Server::uri
private

◆ waitingForOrigin

bool Ftp::Server::waitingForOrigin
private

◆ writer

AsyncCall::Pointer Server::writer
protectedinherited

Definition at line 125 of file Server.h.

Referenced by Server::clientWriteDone(), Server::write(), and Server::writing().

◆ zeroReply

bool ConnStateData::zeroReply
inherited

Definition at line 141 of file client_side.h.


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors