Inheritance diagram for Ftp::Relay:
Collaboration diagram for Ftp::Relay:

Public Types

enum  {
  BEGIN,
  SENT_USER,
  SENT_PASS,
  SENT_TYPE,
  SENT_MDTM,
  SENT_SIZE,
  SENT_EPRT,
  SENT_PORT,
  SENT_EPSV_ALL,
  SENT_EPSV_1,
  SENT_EPSV_2,
  SENT_PASV,
  SENT_CWD,
  SENT_LIST,
  SENT_NLST,
  SENT_REST,
  SENT_RETR,
  SENT_STOR,
  SENT_QUIT,
  READING_DATA,
  WRITING_DATA,
  SENT_MKDIR,
  SENT_FEAT,
  SENT_PWD,
  SENT_CDUP,
  SENT_DATA_REQUEST,
  SENT_COMMAND,
  END
}
 
typedef CbcPointer< AsyncJobPointer
 
typedef CbcPointer< BodyProducerPointer
 
typedef CbcPointer< BodyConsumerPointer
 

Public Member Functions

 Relay (FwdState *const fwdState)
 
virtual ~Relay ()
 
virtual void timeout (const CommTimeoutCbParams &io)
 read timeout handler More...
 
virtual void maybeReadVirginBody ()
 read response data from the network More...
 
void writeCommand (const char *buf)
 
bool handlePasvReply (Ip::Address &remoteAddr)
 
bool handleEpsvReply (Ip::Address &remoteAddr)
 
bool sendEprt ()
 
bool sendPort ()
 
bool sendPassive ()
 
void connectDataChannel ()
 
bool openListenSocket ()
 
void switchTimeoutToDataChannel ()
 
virtual void noteMoreBodyDataAvailable (BodyPipe::Pointer)
 
virtual void noteBodyProductionEnded (BodyPipe::Pointer)
 
virtual void noteBodyProducerAborted (BodyPipe::Pointer)
 
virtual HttpRequestPointer originalRequest ()
 a hack to reach HttpStateData::orignal_request More...
 
virtual void noteAdaptationAnswer (const Adaptation::Answer &answer)
 
virtual void noteAdaptationAclCheckDone (Adaptation::ServiceGroupPointer group)
 
virtual void noteMoreBodySpaceAvailable (BodyPipe::Pointer)
 
virtual void noteBodyConsumerAborted (BodyPipe::Pointer)
 
virtual bool getMoreRequestBody (MemBuf &buf)
 either fill buf with available [encoded] request body bytes or return false More...
 
virtual bool doneAll () const
 whether positive goal has been reached 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 callException (const std::exception &e)
 called when the job throws during an async call More...
 
virtual void * toCbdata ()=0
 

Static Public Member Functions

static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...
 

Public Attributes

CtrlChannel ctrl
 FTP control channel state. More...
 
DataChannel data
 FTP data channel state. More...
 
enum Ftp::Client:: { ... }  ftp_state_t
 
int state
 
char * old_request
 
char * old_reply
 
StoreEntryentry = nullptr
 
FwdState::Pointer fwd
 
HttpRequestPointer request
 
wordlistmessage
 reply message, one wordlist entry per message line More...
 
char * lastCommand
 the command caused the reply More...
 
char * lastReply
 last line of reply: reply status plus message More...
 
int replyCode
 the reply status More...
 

Protected Types

typedef void(Relay::* PreliminaryCb) ()
 
typedef void(Relay::* SM_FUNC) ()
 

Protected Member Functions

const Ftp::MasterStatemaster () const
 A const variant of updateMaster(). More...
 
Ftp::MasterStateupdateMaster ()
 
Ftp::ServerState serverState () const
 
void serverState (const Ftp::ServerState newState)
 Changes server state and debugs about that important event. More...
 
virtual void failed (err_type error=ERR_NONE, int xerrno=0, ErrorState *ftperr=nullptr)
 handle a fatal transaction error, closing the control connection More...
 
virtual void dataChannelConnected (const CommConnectCbParams &io)
 
virtual void serverComplete ()
 
virtual void handleControlReply ()
 
virtual void processReplyBody ()
 
virtual void handleRequestBodyProducerAborted ()
 
virtual bool mayReadVirginReplyBody () const
 whether we may receive more virgin response body bytes More...
 
virtual void completeForwarding ()
 
virtual bool abortOnData (const char *reason)
 
virtual void start ()
 called by AsyncStart; do not call directly More...
 
virtual void swanSong ()
 
void forwardReply ()
 
void forwardError (err_type error=ERR_NONE, int xerrno=0)
 
void failedErrorMessage (err_type error, int xerrno)
 
HttpReplycreateHttpReply (const Http::StatusCode httpStatus, const int64_t clen=0)
 
void handleDataRequest ()
 
void startDataDownload ()
 
void startDataUpload ()
 
bool startDirTracking ()
 
void stopDirTracking ()
 
bool weAreTrackingDir () const
 
void forwardPreliminaryReply (const PreliminaryCb cb)
 
void proceedAfterPreliminaryReply ()
 
void readGreeting ()
 
void sendCommand ()
 
void readReply ()
 
void readFeatReply ()
 
void readPasvReply ()
 
void readDataReply ()
 
void readTransferDoneReply ()
 
void readEpsvReply ()
 
void readCwdOrCdupReply ()
 
void readUserOrPassReply ()
 
void scheduleReadControlReply ()
 
void stopOriginWait (int code)
 Inform Ftp::Server that we are done if originWaitInProgress. More...
 
virtual void closeServer ()
 
virtual bool doneWithServer () const
 
virtual const Comm::ConnectionPointerdataConnection () const
 
virtual void abortAll (const char *reason)
 abnormal transaction termination; reason is for debugging only More...
 
virtual Http::StatusCode failedHttpStatus (err_type &error)
 
void ctrlClosed (const CommCloseCbParams &io)
 handler called by Comm when FTP control channel is closed unexpectedly More...
 
void scheduleReadControlReply (int buffered_ok)
 
void readControlReply (const CommIoCbParams &io)
 
void writeCommandCallback (const CommIoCbParams &io)
 
void dataRead (const CommIoCbParams &io)
 
void dataComplete ()
 
AsyncCall::Pointer dataCloser ()
 creates a data channel Comm close callback More...
 
virtual void dataClosed (const CommCloseCbParams &io)
 handler called by Comm when FTP data channel is closed unexpectedly More...
 
void initReadBuf ()
 
virtual void sentRequestBody (const CommIoCbParams &io)
 
virtual void doneSendingRequestBody ()
 
virtual void haveParsedReplyHeaders ()
 called when we have final (possibly adapted) reply headers; kids extend More...
 
bool startRequestBodyFlow ()
 
void handleMoreRequestBodyAvailable ()
 
void handleRequestBodyProductionEnded ()
 
void sendMoreRequestBody ()
 
bool abortOnBadEntry (const char *abortReason)
 Entry-dependent callbacks use this check to quit if the entry went bad. More...
 
bool blockCaching ()
 whether to prevent caching of an otherwise cachable response More...
 
void startAdaptation (const Adaptation::ServiceGroupPointer &group, HttpRequest *cause)
 Initiate an asynchronous adaptation transaction which will call us back. More...
 
void adaptVirginReplyBody (const char *buf, ssize_t len)
 
void cleanAdaptation ()
 
virtual bool doneWithAdaptation () const
 
void handleMoreAdaptedBodyAvailable ()
 
void handleAdaptedBodyProductionEnded ()
 
void handleAdaptedBodyProducerAborted ()
 
void handleAdaptedHeader (Http::Message *msg)
 
void handleAdaptationCompleted ()
 
void handleAdaptationBlocked (const Adaptation::Answer &answer)
 
void handleAdaptationAborted (bool bypassable=false)
 
bool handledEarlyAdaptationAbort ()
 
void resumeBodyStorage ()
 called by StoreEntry when it has more buffer space available More...
 
void endAdaptedBodyConsumption ()
 called when the entire adapted response body is consumed More...
 
const HttpReplyvirginReply () const
 
HttpReplyvirginReply ()
 
HttpReplysetVirginReply (HttpReply *r)
 
HttpReplyfinalReply ()
 
HttpReplysetFinalReply (HttpReply *r)
 
void adaptOrFinalizeReply ()
 
void addVirginReplyBody (const char *buf, ssize_t len)
 
void storeReplyBody (const char *buf, ssize_t len)
 
size_t replyBodySpace (const MemBuf &readBuf, const size_t minSpace) const
 
size_t calcBufferSpaceToReserve (const size_t space, const size_t wantSpace) const
 determine how much space the buffer needs to reserve More...
 
void adjustBodyBytesRead (const int64_t delta)
 initializes bodyBytesRead stats if needed and applies delta More...
 
CbcPointer< Initiate > initiateAdaptation (Initiate *x)
 < starts freshly created initiate and returns a safe pointer to it More...
 
void clearAdaptation (CbcPointer< Initiate > &x)
 clears the pointer (does not call announceInitiatorAbort) More...
 
void announceInitiatorAbort (CbcPointer< Initiate > &x)
 inform the transaction about abnormal termination and clear the pointer More...
 
bool initiated (const CbcPointer< AsyncJob > &job) const
 Must(initiated(initiate)) instead of Must(initiate.set()), for clarity. More...
 
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)
 
void stopConsumingFrom (RefCount< BodyPipe > &)
 

Static Protected Member Functions

static void abort (void *d)
 

Protected Attributes

PreliminaryCb thePreliminaryCb
 
bool forwardingCompleted
 completeForwarding() has been called More...
 
bool originWaitInProgress
 
struct {
   wordlist *   message
 reply message, one wordlist entry per message line More...
 
   char *   lastCommand
 the command caused the reply More...
 
   char *   lastReply
 last line of reply: reply status plus message More...
 
   int   replyCode
 the reply status More...
 
savedReply
 set and delayed while we are tracking using PWD More...
 
int64_t currentOffset = 0
 
MemBufresponseBodyBuffer = nullptr
 
BodyPipe::Pointer requestBodySource
 
AsyncCall::Pointer requestSender
 
BodyPipe::Pointer virginBodyDestination
 
CbcPointer< Adaptation::InitiateadaptedHeadSource
 
BodyPipe::Pointer adaptedBodySource
 
bool adaptationAccessCheckPending = false
 
bool startedAdaptation = false
 
bool receivedWholeRequestBody = false
 handleRequestBodyProductionEnded called More...
 
const char * doneWithFwd = nullptr
 
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...
 

Static Protected Attributes

static const SM_FUNC SM_FUNCS []
 

Private Member Functions

 CBDATA_CLASS (Relay)
 
bool parseControlReply (size_t &bytesUsed)
 
void serverComplete2 ()
 
void sendBodyIsTooLargeError ()
 
void maybePurgeOthers ()
 

Private Attributes

bool shortenReadTimeout
 
bool completed = false
 
HttpReplytheVirginReply = nullptr
 
HttpReplytheFinalReply = nullptr
 

Detailed Description

An FTP client receiving native FTP commands from our FTP server (Ftp::Server), forwarding them to the next FTP hop, and then relaying FTP replies back to our FTP server.

Definition at line 33 of file FtpRelay.cc.

Member Typedef Documentation

◆ Pointer [1/3]

Definition at line 25 of file BodyPipe.h.

◆ Pointer [2/3]

Definition at line 34 of file AsyncJob.h.

◆ Pointer [3/3]

Definition at line 45 of file BodyPipe.h.

◆ PreliminaryCb

typedef void(Relay::* Ftp::Relay::PreliminaryCb) ()
protected

Definition at line 75 of file FtpRelay.cc.

◆ SM_FUNC

typedef void(Relay::* Ftp::Relay::SM_FUNC) ()
protected

Definition at line 80 of file FtpRelay.cc.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
BEGIN 
SENT_USER 
SENT_PASS 
SENT_TYPE 
SENT_MDTM 
SENT_SIZE 
SENT_EPRT 
SENT_PORT 
SENT_EPSV_ALL 
SENT_EPSV_1 
SENT_EPSV_2 
SENT_PASV 
SENT_CWD 
SENT_LIST 
SENT_NLST 
SENT_REST 
SENT_RETR 
SENT_STOR 
SENT_QUIT 
READING_DATA 
WRITING_DATA 
SENT_MKDIR 
SENT_FEAT 
SENT_PWD 
SENT_CDUP 
SENT_DATA_REQUEST 
SENT_COMMAND 
END 

Definition at line 127 of file FtpClient.h.

Constructor & Destructor Documentation

◆ Relay()

Ftp::Relay::Relay ( FwdState *const  fwdState)
explicit

◆ ~Relay()

Ftp::Relay::~Relay ( )
virtual

Definition at line 168 of file FtpRelay.cc.

References wordlistDestroy(), and xfree.

Member Function Documentation

◆ abort()

void Ftp::Relay::abort ( void *  d)
staticprotected

◆ abortAll()

void Ftp::Client::abortAll ( const char *  reason)
protectedvirtualinherited

Implements Client.

Definition at line 1020 of file FtpClient.cc.

References data, debugs, and NULL.

◆ abortOnBadEntry()

◆ abortOnData()

bool Ftp::Relay::abortOnData ( const char *  reason)
protectedvirtual

abnormal data transfer termination

Return values
truethe transaction will be terminated (abortAll called)
falsethe transaction will survive

Reimplemented from Client.

Definition at line 751 of file FtpRelay.cc.

References data, debugs, Comm::IsConnOpen(), and NULL.

◆ adaptOrFinalizeReply()

◆ adaptVirginReplyBody()

void Client::adaptVirginReplyBody ( const char *  buf,
ssize_t  len 
)
protectedinherited

◆ addVirginReplyBody()

◆ adjustBodyBytesRead()

void Client::adjustBodyBytesRead ( const int64_t  delta)
protectedinherited

◆ announceInitiatorAbort()

void Adaptation::Initiator::announceInitiatorAbort ( CbcPointer< Initiate > &  x)
protectedinherited

Definition at line 38 of file Initiator.cc.

References CallJobHere.

Referenced by Client::cleanAdaptation(), and ClientHttpRequest::~ClientHttpRequest().

◆ blockCaching()

◆ calcBufferSpaceToReserve()

size_t Client::calcBufferSpaceToReserve ( const size_t  space,
const size_t  wantSpace 
) const
protectedinherited

◆ callEnd()

void AsyncJob::callEnd ( )
virtualinherited

◆ callException()

◆ 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.

◆ CBDATA_CLASS()

Ftp::Relay::CBDATA_CLASS ( Relay  )
private

◆ cleanAdaptation()

◆ clearAdaptation()

void Adaptation::Initiator::clearAdaptation ( CbcPointer< Initiate > &  x)
protectedinherited

◆ closeServer()

void Ftp::Client::closeServer ( )
protectedvirtualinherited

Close the FTP server connection(s). Used by serverComplete().

Implements Client.

Definition at line 217 of file FtpClient.cc.

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

◆ completeForwarding()

void Ftp::Relay::completeForwarding ( )
protectedvirtual

Ensure we do not double-complete on the forward entry. We complete forwarding when the response adaptation is over (but we may still be waiting for 226 from the FTP server) and also when we get that 226 from the server (and adaptation is done).

Todo:
Rewrite FwdState to ignore double completion?

Reimplemented from Client.

Definition at line 267 of file FtpRelay.cc.

References Client::completeForwarding(), and debugs.

◆ connectDataChannel()

◆ createHttpReply()

HttpReply * Ftp::Relay::createHttpReply ( const Http::StatusCode  httpStatus,
const int64_t  clen = 0 
)
protected

◆ ctrlClosed()

void Ftp::Client::ctrlClosed ( const CommCloseCbParams io)
protectedinherited

Definition at line 862 of file FtpClient.cc.

References debugs.

Referenced by Ftp::Client::Client().

◆ dataChannelConnected()

void Ftp::Relay::dataChannelConnected ( const CommConnectCbParams io)
protectedvirtual

◆ dataClosed()

void Ftp::Client::dataClosed ( const CommCloseCbParams io)
protectedvirtualinherited

Reimplemented in Ftp::Gateway.

Definition at line 794 of file FtpClient.cc.

References data, debugs, and NULL.

Referenced by Ftp::Client::dataCloser().

◆ dataCloser()

AsyncCall::Pointer Ftp::Client::dataCloser ( )
protectedinherited

Definition at line 786 of file FtpClient.cc.

References Ftp::Client::dataClosed(), and JobCallback.

◆ dataComplete()

void Client::dataComplete ( )
protectedinherited

Close data channel, if any, to conserve resources while we wait.

Definition at line 991 of file FtpClient.cc.

References data, and debugs.

Referenced by abort().

◆ dataConnection()

const Comm::ConnectionPointer & Client::dataConnection ( ) const
protectedvirtualinherited
Returns
primary or "request data connection"

Implements Client.

Definition at line 883 of file FtpClient.cc.

References data.

◆ dataRead()

◆ deleteThis()

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

◆ done()

bool AsyncJob::done ( ) const
protectedinherited

◆ doneAll()

bool Client::doneAll ( ) const
virtualinherited

Reimplemented from AsyncJob.

Definition at line 197 of file Client.cc.

References AsyncJob::doneAll(), Client::doneWithAdaptation(), and Client::doneWithServer().

◆ doneSendingRequestBody()

void Ftp::Client::doneSendingRequestBody ( )
protectedvirtualinherited

called after we wrote the last byte of the request body

Implements Client.

Definition at line 1054 of file FtpClient.cc.

References debugs, and Client::doneSendingRequestBody().

◆ doneWithAdaptation()

bool Client::doneWithAdaptation ( ) const
protectedvirtualinherited

◆ doneWithServer()

bool Ftp::Client::doneWithServer ( ) const
protectedvirtualinherited

Did we close all FTP server connection(s)?

Return values
trueBoth server control and data channels are closed. And not waiting for a new data connection to open.
falseEither control channel or data is still active.

Implements Client.

Definition at line 240 of file FtpClient.cc.

References data, and Comm::IsConnOpen().

◆ endAdaptedBodyConsumption()

void Client::endAdaptedBodyConsumption ( )
protectedinherited

◆ failed()

void Ftp::Relay::failed ( err_type  error = ERR_NONE,
int  xerrno = 0,
ErrorState ftperr = nullptr 
)
protectedvirtual

Reimplemented from Ftp::Client.

Definition at line 277 of file FtpRelay.cc.

References error(), Ftp::Client::failed(), and Ftp::fssError.

◆ failedErrorMessage()

void Ftp::Relay::failedErrorMessage ( err_type  error,
int  xerrno 
)
protected

Definition at line 290 of file FtpRelay.cc.

References error().

◆ failedHttpStatus()

Http::StatusCode Client::failedHttpStatus ( err_type error)
protectedvirtualinherited

◆ finalReply()

HttpReply * Client::finalReply ( )
protectedinherited

Definition at line 130 of file Client.cc.

References assert, and Client::theFinalReply.

Referenced by HttpStateData::haveParsedReplyHeaders(), and HttpStateData::reusableReply().

◆ forwardError()

void Ftp::Relay::forwardError ( err_type  error = ERR_NONE,
int  xerrno = 0 
)
protected

Definition at line 419 of file FtpRelay.cc.

References error().

◆ forwardPreliminaryReply()

void Ftp::Relay::forwardPreliminaryReply ( const PreliminaryCb  cb)
protected

◆ forwardReply()

void Ftp::Relay::forwardReply ( )
protected

Definition at line 374 of file FtpRelay.cc.

References assert, Http::scNoContent, and Http::Message::srcFtp.

◆ getMoreRequestBody()

bool Client::getMoreRequestBody ( MemBuf buf)
virtualinherited

◆ handleAdaptationAborted()

void Client::handleAdaptationAborted ( bool  bypassable = false)
protectedinherited

◆ handleAdaptationBlocked()

◆ handleAdaptationCompleted()

◆ handleAdaptedBodyProducerAborted()

◆ handleAdaptedBodyProductionEnded()

void Client::handleAdaptedBodyProductionEnded ( )
protectedinherited

◆ handleAdaptedHeader()

◆ handleControlReply()

void Ftp::Relay::handleControlReply ( )
protectedvirtual

Reimplemented from Ftp::Client.

Definition at line 341 of file FtpRelay.cc.

References assert, debugs, Ftp::Client::handleControlReply(), NULL, and request().

◆ handleDataRequest()

void Ftp::Relay::handleDataRequest ( )
protected

Definition at line 437 of file FtpRelay.cc.

References data.

◆ handledEarlyAdaptationAbort()

bool Client::handledEarlyAdaptationAbort ( )
protectedinherited

◆ handleEpsvReply()

bool Client::handleEpsvReply ( Ip::Address remoteAddr)
inherited

◆ handleMoreAdaptedBodyAvailable()

◆ handleMoreRequestBodyAvailable()

void Client::handleMoreRequestBodyAvailable ( )
protectedinherited

◆ handlePasvReply()

bool Client::handlePasvReply ( Ip::Address remoteAddr)
inherited

extracts remoteAddr from PASV response, validates it, sets data address details, and returns true on success

Definition at line 439 of file FtpClient.cc.

References buf, code, Config, data, DBG_IMPORTANT, debugs, fd_table, SquidConfig::Ftp, Comm::IsConnOpen(), NULL, Ftp::ParseIpPort(), and SquidConfig::sanitycheck.

Referenced by ftpReadPasv().

◆ handleRequestBodyProducerAborted()

void Ftp::Relay::handleRequestBodyProducerAborted ( )
protectedvirtual

Implements Client.

Definition at line 359 of file FtpRelay.cc.

References ERR_READ_ERROR, and Client::handleRequestBodyProducerAborted().

◆ handleRequestBodyProductionEnded()

void Client::handleRequestBodyProductionEnded ( )
protectedinherited

◆ haveParsedReplyHeaders()

void Client::haveParsedReplyHeaders ( )
protectedvirtualinherited

◆ initiateAdaptation()

CbcPointer< Adaptation::Initiate > Adaptation::Initiator::initiateAdaptation ( Initiate x)
protectedinherited

◆ initiated()

bool Adaptation::Initiator::initiated ( const CbcPointer< AsyncJob > &  job) const
inlineprotectedinherited

Definition at line 52 of file Initiator.h.

References CbcPointer< Cbc >::set().

Referenced by Client::startAdaptation(), and ClientHttpRequest::startAdaptation().

◆ initReadBuf()

void Client::initReadBuf ( )
protectedinherited

Definition at line 205 of file FtpClient.cc.

References data, and NULL.

◆ master()

const Ftp::MasterState & Ftp::Relay::master ( ) const
protected

Definition at line 244 of file FtpRelay.cc.

Referenced by serverState().

◆ maybePurgeOthers()

◆ maybeReadVirginBody()

void Client::maybeReadVirginBody ( )
virtualinherited

◆ mayReadVirginReplyBody()

bool Ftp::Relay::mayReadVirginReplyBody ( ) const
protectedvirtual

Implements Client.

Definition at line 367 of file FtpRelay.cc.

References data, and Comm::IsConnOpen().

◆ mustStop()

◆ noteAdaptationAclCheckDone()

void Client::noteAdaptationAclCheckDone ( Adaptation::ServiceGroupPointer  group)
virtualinherited

AccessCheck calls this back with a possibly nil service group to signal whether adaptation is needed and where it should start.

Reimplemented from Adaptation::Initiator.

Definition at line 910 of file Client.cc.

References Client::abortOnBadEntry(), Client::adaptationAccessCheckPending, debugs, HERE(), Client::originalRequest(), Client::processReplyBody(), Client::request, Client::sendBodyIsTooLargeError(), Client::setFinalReply(), Client::startAdaptation(), and Client::virginReply().

◆ noteAdaptationAnswer()

void Client::noteAdaptationAnswer ( const Adaptation::Answer answer)
virtualinherited

◆ noteBodyConsumerAborted()

void Client::noteBodyConsumerAborted ( BodyPipe::Pointer  )
virtualinherited

◆ noteBodyProducerAborted()

void Client::noteBodyProducerAborted ( BodyPipe::Pointer  bp)
virtualinherited

◆ noteBodyProductionEnded()

void Client::noteBodyProductionEnded ( BodyPipe::Pointer  bp)
virtualinherited

◆ noteMoreBodyDataAvailable()

void Client::noteMoreBodyDataAvailable ( BodyPipe::Pointer  bp)
virtualinherited

◆ noteMoreBodySpaceAvailable()

void Client::noteMoreBodySpaceAvailable ( BodyPipe::Pointer  )
virtualinherited

◆ openListenSocket()

bool Client::openListenSocket ( )
inherited

Definition at line 779 of file FtpClient.cc.

◆ originalRequest()

◆ parseControlReply()

bool Ftp::Client::parseControlReply ( size_t bytesUsed)
privateinherited

Parses FTP server control response into ctrl structure fields, setting bytesUsed and returning true on success.

Definition at line 1068 of file FtpClient.cc.

References assert, Ftp::crlf, debugs, head, wordlist::key, len, wordlist::next, NULL, safe_free, wordlistDestroy(), xmalloc, xstrdup, and xstrncpy().

◆ proceedAfterPreliminaryReply()

void Ftp::Relay::proceedAfterPreliminaryReply ( )
protected

Definition at line 408 of file FtpRelay.cc.

References debugs, Must, and NULL.

Referenced by forwardPreliminaryReply().

◆ processReplyBody()

void Ftp::Relay::processReplyBody ( )
protectedvirtual

Implements Client.

Definition at line 299 of file FtpRelay.cc.

References data, debugs, EBIT_TEST, ENTRY_ABORTED, and NULL.

◆ readControlReply()

◆ readCwdOrCdupReply()

void Ftp::Relay::readCwdOrCdupReply ( )
protected

Definition at line 676 of file FtpRelay.cc.

References assert, debugs, Ftp::fssHandleCdup, Ftp::fssHandleCwd, and Ftp::Is1xx().

◆ readDataReply()

void Ftp::Relay::readDataReply ( )
protected

◆ readEpsvReply()

void Ftp::Relay::readEpsvReply ( )
protected

Definition at line 602 of file FtpRelay.cc.

References Ftp::Is1xx(), and NULL.

◆ readFeatReply()

void Ftp::Relay::readFeatReply ( )
protected

Definition at line 577 of file FtpRelay.cc.

References assert, Ftp::fssHandleFeat, and Ftp::Is1xx().

◆ readGreeting()

void Ftp::Relay::readGreeting ( )
protected

◆ readPasvReply()

void Ftp::Relay::readPasvReply ( )
protected

◆ readReply()

void Ftp::Relay::readReply ( )
protected

◆ readTransferDoneReply()

void Ftp::Relay::readTransferDoneReply ( )
protected

Definition at line 711 of file FtpRelay.cc.

References DBG_IMPORTANT, and debugs.

◆ readUserOrPassReply()

void Ftp::Relay::readUserOrPassReply ( )
protected

Definition at line 695 of file FtpRelay.cc.

References Ftp::Is1xx().

◆ replyBodySpace()

size_t Client::replyBodySpace ( const MemBuf readBuf,
const size_t  minSpace 
) const
protectedinherited

◆ resumeBodyStorage()

◆ scheduleReadControlReply() [1/2]

void Ftp::Relay::scheduleReadControlReply ( )
protected

Definition at line 745 of file FtpRelay.cc.

References Ftp::Client::scheduleReadControlReply().

Referenced by readGreeting(), and readReply().

◆ scheduleReadControlReply() [2/2]

void Ftp::Client::scheduleReadControlReply ( int  buffered_ok)
protectedinherited

DPW 2007-04-23 Looks like there are no longer anymore callers that set buffered_ok=1. Perhaps it can be removed at some point.

Definition at line 309 of file FtpClient.cc.

References comm_read(), commSetConnTimeout(), commUnsetConnTimeout(), Config, SquidConfig::connect, data, debugs, Comm::IsConnOpen(), JobCallback, min(), SquidConfig::read, Ftp::Client::readControlReply(), Ftp::Client::timeout(), and SquidConfig::Timeout.

Referenced by scheduleReadControlReply().

◆ sendBodyIsTooLargeError()

void Client::sendBodyIsTooLargeError ( )
privateinherited

◆ sendCommand()

◆ sendEprt()

◆ sendMoreRequestBody()

◆ sendPassive()

bool Client::sendPassive ( )
inherited
Checks for EPSV ALL special conditions: If enabled to be sent, squid MUST NOT request any other connect methods. If 'ALL' is sent and fails the entire FTP Session fails. NP: By my reading exact EPSV protocols maybe attempted, but only EPSV method.

Closes any old FTP-Data connection which may exist. *‍/

Checks for previous EPSV/PASV failures on this server/session. Diverts to EPRT immediately if they are not working.
Send EPSV (ALL,2,1) or PASV on the control channel.
  • EPSV ALL is used if enabled.
  • EPSV 2 is used if ALL is disabled and IPv6 is available and ctrl channel is IPv6.
  • EPSV 1 is used if EPSV 2 (IPv6) fails or is not available or ctrl channel is IPv4.
  • PASV is used if EPSV 1 fails.

Definition at line 637 of file FtpClient.cc.

References SquidConfig::accessList, Acl::Answer::allowed(), Packable::appendf(), Config, MemBuf::content(), Ftp::crlf, data, DBG_IMPORTANT, debugs, SquidConfig::epsv_all, ERR_FTP_FAILURE, ACLChecklist::fastCheck(), SquidConfig::Ftp, SquidConfig::ftp_epsv, NULL, SquidConfig::passive, MemBuf::reset(), and wordlistDestroy().

◆ sendPort()

bool Client::sendPort ( )
inherited

Definition at line 630 of file FtpClient.cc.

References ERR_FTP_FAILURE.

◆ sentRequestBody()

void Client::sentRequestBody ( const CommIoCbParams io)
protectedvirtualinherited

◆ serverComplete()

void Ftp::Relay::serverComplete ( )
protectedvirtual

Keep control connection for future requests, after we are done with it. Similar to COMPLETE_PERSISTENT_MSG handling in http.cc.

Definition at line 200 of file FtpRelay.cc.

References CallJobHere1, debugs, Comm::IsConnOpen(), Client::serverComplete(), ConnStateData::unpinConnection(), and CbcPointer< Cbc >::valid().

◆ serverComplete2()

void Client::serverComplete2 ( )
privateinherited

◆ serverState() [1/2]

Ftp::ServerState Ftp::Relay::serverState ( ) const
inlineprotected

Definition at line 44 of file FtpRelay.cc.

References master(), and Ftp::MasterState::serverState.

◆ serverState() [2/2]

void Ftp::Relay::serverState ( const Ftp::ServerState  newState)
protected

Definition at line 251 of file FtpRelay.cc.

References debugs.

◆ setFinalReply()

◆ setVirginReply()

HttpReply * Client::setVirginReply ( HttpReply r)
protectedinherited

◆ start()

void Ftp::Relay::start ( )
protectedvirtual

Reimplemented from Ftp::Client.

Definition at line 179 of file FtpRelay.cc.

References Ftp::fssHandleDataRequest, Ftp::fssHandleUploadRequest, and Ftp::Client::start().

◆ Start()

◆ startAdaptation()

◆ startDataDownload()

void Ftp::Relay::startDataDownload ( )
protected

◆ startDataUpload()

void Ftp::Relay::startDataUpload ( )
protected

Definition at line 462 of file FtpRelay.cc.

References assert, data, debugs, and Comm::IsConnOpen().

Referenced by readDataReply().

◆ startDirTracking()

bool Ftp::Relay::startDirTracking ( )
protected

Definition at line 634 of file FtpRelay.cc.

References debugs, and NULL.

◆ startRequestBodyFlow()

bool Client::startRequestBodyFlow ( )
protectedinherited

◆ status()

const char * AsyncJob::status ( ) const
protectedvirtualinherited

◆ stopConsumingFrom()

◆ stopDirTracking()

void Ftp::Relay::stopDirTracking ( )
protected

Definition at line 654 of file FtpRelay.cc.

References debugs, NULL, safe_free, Ftp::UnescapeDoubleQuoted(), and wordlistDestroy().

◆ stopOriginWait()

void Ftp::Relay::stopOriginWait ( int  code)
protected

◆ stopProducingFor()

void BodyProducer::stopProducingFor ( RefCount< BodyPipe > &  p,
bool  atEof 
)
protectedinherited

◆ storeReplyBody()

void Client::storeReplyBody ( const char *  buf,
ssize_t  len 
)
protectedinherited

Definition at line 998 of file Client.cc.

References Client::currentOffset, data, Client::entry, len, and StoreEntry::write().

Referenced by Client::addVirginReplyBody().

◆ swanSong()

void Ftp::Relay::swanSong ( )
protectedvirtual

Reimplemented from Client.

Definition at line 191 of file FtpRelay.cc.

References Client::swanSong().

◆ switchTimeoutToDataChannel()

void Ftp::Client::switchTimeoutToDataChannel ( )
inherited

Cancel the timeout on the Control socket and establish one on the data socket

Definition at line 1032 of file FtpClient.cc.

References commSetConnTimeout(), commUnsetConnTimeout(), Config, data, JobCallback, SquidConfig::read, Ftp::Client::timeout(), and SquidConfig::Timeout.

Referenced by ftpReadList(), and ftpReadRetr().

◆ timeout()

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

◆ updateMaster()

Ftp::MasterState & Ftp::Relay::updateMaster ( )
protected

Safely returns the master state, with safety checks in case the Ftp::Server side of the master xact is gone.

Definition at line 228 of file FtpRelay.cc.

References debugs, CbcPointer< Cbc >::get(), and CbcPointer< Cbc >::valid().

◆ virginReply() [1/2]

HttpReply * Client::virginReply ( )
protectedinherited

Definition at line 103 of file Client.cc.

References assert, and Client::theVirginReply.

◆ virginReply() [2/2]

◆ weAreTrackingDir()

bool Ftp::Relay::weAreTrackingDir ( ) const
inlineprotected

Definition at line 73 of file FtpRelay.cc.

References NULL, and savedReply.

◆ writeCommand()

◆ writeCommandCallback()

Member Data Documentation

◆ adaptationAccessCheckPending

◆ adaptedBodySource

◆ adaptedHeadSource

CbcPointer<Adaptation::Initiate> Client::adaptedHeadSource
protectedinherited

to get adapted response headers

Definition at line 174 of file Client.h.

Referenced by Client::cleanAdaptation(), Client::doneWithAdaptation(), Client::noteAdaptationAnswer(), and Client::startAdaptation().

◆ completed

bool Client::completed = false
privateinherited

serverComplete() has been called

Definition at line 86 of file Client.h.

Referenced by Client::noteMoreBodySpaceAvailable(), and Client::serverComplete().

◆ ctrl

◆ currentOffset

int64_t Client::currentOffset = 0
protectedinherited

◆ data

DataChannel Ftp::Client::data
inherited

Definition at line 125 of file FtpClient.h.

Referenced by abort(), ftpOpenListenSocket(), ftpReadList(), ftpReadRetr(), and ftpSendPORT().

◆ doneWithFwd

const char* Client::doneWithFwd = nullptr
protectedinherited

whether we should not be talking to FwdState; XXX: clear fwd instead points to a string literal which is used only for debugging

Definition at line 184 of file Client.h.

Referenced by Client::completeForwarding(), HttpStateData::httpStateConnClosed(), and Client::swanSong().

◆ entry

◆ forwardingCompleted

bool Ftp::Relay::forwardingCompleted
protected

Definition at line 100 of file FtpRelay.cc.

◆ ftp_state_t

enum { ... } Ftp::Client::ftp_state_t

◆ fwd

◆ id

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 72 of file AsyncJob.h.

◆ inCall

AsyncCall::Pointer AsyncJob::inCall
protectedinherited

◆ lastCommand

char* Ftp::Relay::lastCommand

Definition at line 108 of file FtpRelay.cc.

◆ lastReply

char* Ftp::Relay::lastReply

Definition at line 109 of file FtpRelay.cc.

◆ message

wordlist* Ftp::Relay::message

Definition at line 107 of file FtpRelay.cc.

◆ old_reply

char* Ftp::Client::old_reply
inherited

Definition at line 160 of file FtpClient.h.

Referenced by ftpSendReply().

◆ old_request

char* Ftp::Client::old_request
inherited

Definition at line 159 of file FtpClient.h.

Referenced by ftpSendReply().

◆ originWaitInProgress

bool Ftp::Relay::originWaitInProgress
protected

whether we are between Ftp::Server::startWaitingForOrigin() and Ftp::Server::stopWaitingForOrigin() calls

Definition at line 104 of file FtpRelay.cc.

◆ receivedWholeRequestBody

bool Client::receivedWholeRequestBody = false
protectedinherited

◆ replyCode

int Ftp::Relay::replyCode

Definition at line 110 of file FtpRelay.cc.

◆ request

◆ requestBodySource

◆ requestSender

◆ responseBodyBuffer

MemBuf* Client::responseBodyBuffer = nullptr
protectedinherited

◆ savedReply

struct { ... } Ftp::Relay::savedReply

Referenced by Relay(), and weAreTrackingDir().

◆ shortenReadTimeout

bool Ftp::Client::shortenReadTimeout
privateinherited

XXX: An old hack for FTP servers like ftp.netscape.com that may not respond to PASV. Use faster connect timeout instead of read timeout.

Definition at line 194 of file FtpClient.h.

◆ SM_FUNCS

◆ startedAdaptation

bool Client::startedAdaptation = false
protectedinherited

◆ state

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ theFinalReply

HttpReply* Client::theFinalReply = nullptr
privateinherited

adapted reply from ICAP or virgin reply

Definition at line 191 of file Client.h.

Referenced by Client::finalReply(), Client::haveParsedReplyHeaders(), Client::maybePurgeOthers(), Client::setFinalReply(), and Client::~Client().

◆ thePreliminaryCb

PreliminaryCb Ftp::Relay::thePreliminaryCb
protected

Definition at line 78 of file FtpRelay.cc.

◆ theVirginReply

HttpReply* Client::theVirginReply = nullptr
privateinherited

reply received from the origin server

Definition at line 190 of file Client.h.

Referenced by Client::setVirginReply(), Client::virginReply(), and Client::~Client().

◆ typeName

◆ virginBodyDestination


The documentation for this class was generated from the following file:
void readFeatReply()
Definition: FtpRelay.cc:577
void readCwdOrCdupReply()
Definition: FtpRelay.cc:676
#define NULL
Definition: types.h:166
void readDataReply()
Definition: FtpRelay.cc:617
void readEpsvReply()
Definition: FtpRelay.cc:602
void readTransferDoneReply()
Definition: FtpRelay.cc:711
void readReply()
Definition: FtpRelay.cc:565
void readGreeting()
Definition: FtpRelay.cc:478
void readUserOrPassReply()
Definition: FtpRelay.cc:695
void readPasvReply()
Definition: FtpRelay.cc:588

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors