FTP client functionality shared among FTP Gateway and Relay clients. More...

#include <FtpClient.h>

Inheritance diagram for Ftp::Client:
Collaboration diagram for Ftp::Client:

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

 Client (FwdState *fwdState)
 
virtual ~Client ()
 
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 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 bool abortOnData (const char *reason)
 
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 void processReplyBody ()=0
 
virtual void swanSong ()
 
virtual bool doneAll () const
 whether positive goal has been reached More...
 
void serverComplete ()
 
void markParsedVirginReplyAsWhole (const char *reasonWeAreSure)
 
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...
 
void handleStopRequest ()
 process external request to terminate now (i.e. during this async call) More...
 
virtual void * toCbdata ()=0
 

Static Public Member Functions

static void Start (const Pointer &job)
 

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
 
const InstanceId< AsyncJobid
 job identifier More...
 

Protected Member Functions

virtual void start ()
 called by AsyncStart; do not call directly 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)
 
virtual void handleControlReply ()
 
void writeCommandCallback (const CommIoCbParams &io)
 
virtual void dataChannelConnected (const CommConnectCbParams &io)=0
 
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...
 
virtual void completeForwarding ()
 
bool startRequestBodyFlow ()
 
void handleMoreRequestBodyAvailable ()
 
void handleRequestBodyProductionEnded ()
 
virtual void handleRequestBodyProducerAborted ()=0
 
void sendMoreRequestBody ()
 
virtual bool mayReadVirginReplyBody () const =0
 whether we may receive more virgin response body bytes More...
 
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 > &)
 

Protected Attributes

JobWait< Comm::ConnOpenerdataConnWait
 
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 receivedWholeAdaptedReply = false
 handleAdaptedBodyProductionEnded() was called More...
 
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...
 
bool started_ = false
 Start() has finished successfully. More...
 
bool swanSang_ = false
 swanSong() was called More...
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 110 of file FtpClient.h.

Member Typedef Documentation

◆ Pointer [1/3]

Definition at line 34 of file AsyncJob.h.

◆ Pointer [2/3]

Definition at line 25 of file BodyPipe.h.

◆ Pointer [3/3]

Definition at line 45 of file BodyPipe.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
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 145 of file FtpClient.h.

Constructor & Destructor Documentation

◆ Client()

◆ ~Client()

Client::~Client ( )
virtual

Reimplemented from Client.

Definition at line 203 of file FtpClient.cc.

References NULL, and safe_free.

Member Function Documentation

◆ abortAll()

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

Implements Client.

Definition at line 1037 of file FtpClient.cc.

References debugs, and NULL.

◆ abortOnBadEntry()

◆ abortOnData()

bool Client::abortOnData ( const char *  reason)
virtualinherited

abnormal data transfer termination

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

Reimplemented in Ftp::Relay.

Definition at line 312 of file Client.cc.

References Client::abortAll().

Referenced by Client::abortOnBadEntry(), Client::handleAdaptationBlocked(), Client::sendBodyIsTooLargeError(), and Client::sentRequestBody().

◆ 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 ClientHttpRequest::~ClientHttpRequest(), and Client::cleanAdaptation().

◆ 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 102 of file AsyncJob.cc.

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

◆ CBDATA_CLASS()

Ftp::Client::CBDATA_CLASS ( Client  )
private

◆ cleanAdaptation()

◆ clearAdaptation()

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

◆ closeServer()

void Ftp::Client::closeServer ( )
protectedvirtual

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

Implements Client.

Definition at line 231 of file FtpClient.cc.

References debugs, and Comm::IsConnOpen().

◆ completeForwarding()

void Client::completeForwarding ( )
protectedvirtualinherited

◆ connectDataChannel()

void Ftp::Client::connectDataChannel ( )

◆ ctrlClosed()

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

Definition at line 877 of file FtpClient.cc.

References debugs.

Referenced by Client().

◆ dataChannelConnected()

virtual void Ftp::Client::dataChannelConnected ( const CommConnectCbParams io)
protectedpure virtual

Implemented in Ftp::Relay, and Ftp::Gateway.

Referenced by connectDataChannel().

◆ dataClosed()

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

Reimplemented in Ftp::Gateway.

Definition at line 808 of file FtpClient.cc.

References debugs, and NULL.

Referenced by Ftp::Gateway::dataClosed(), and dataCloser().

◆ dataCloser()

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

Definition at line 800 of file FtpClient.cc.

References dataClosed(), and JobCallback.

◆ dataComplete()

void Client::dataComplete ( )
protected

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

Definition at line 1008 of file FtpClient.cc.

References debugs.

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

◆ dataConnection()

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

Implements Client.

Definition at line 900 of file FtpClient.cc.

◆ 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 218 of file Client.cc.

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

◆ doneSendingRequestBody()

void Ftp::Client::doneSendingRequestBody ( )
protectedvirtual

called after we wrote the last byte of the request body

Implements Client.

Definition at line 1071 of file FtpClient.cc.

References debugs, and Client::doneSendingRequestBody().

◆ doneWithAdaptation()

bool Client::doneWithAdaptation ( ) const
protectedvirtualinherited

◆ doneWithServer()

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

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 254 of file FtpClient.cc.

References Comm::IsConnOpen().

◆ endAdaptedBodyConsumption()

◆ failed()

◆ failedHttpStatus()

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

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

◆ 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 Client::handleControlReply ( )
protectedvirtual

Reimplemented in Ftp::Relay, and Ftp::Gateway.

Definition at line 417 of file FtpClient.cc.

References assert, debugs, memReallocBuf(), and wordlistDestroy().

Referenced by Ftp::Gateway::handleControlReply(), and Ftp::Relay::handleControlReply().

◆ handledEarlyAdaptationAbort()

bool Client::handledEarlyAdaptationAbort ( )
protectedinherited

If the store entry is still empty, fully handles adaptation abort, returning true. Otherwise just updates the request error detail and returns false.

Definition at line 902 of file Client.cc.

References Client::abortAll(), FwdState::al, debugs, HttpRequest::detailError(), FwdState::dontRetry(), Client::entry, ERR_ICAP_FAILURE, FwdState::fail(), Client::fwd, RefCount< C >::getRaw(), StoreEntry::isEmpty(), MakeNamedErrorDetail(), Client::request, and Http::scInternalServerError.

Referenced by Client::handleAdaptationAborted(), and Client::handleAdaptedBodyProducerAborted().

◆ handleEpsvReply()

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

◆ handleMoreAdaptedBodyAvailable()

◆ handleMoreRequestBodyAvailable()

void Client::handleMoreRequestBodyAvailable ( )
protectedinherited

◆ handlePasvReply()

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

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

Definition at line 453 of file FtpClient.cc.

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

Referenced by ftpReadPasv().

◆ handleRequestBodyProducerAborted()

◆ handleRequestBodyProductionEnded()

void Client::handleRequestBodyProductionEnded ( )
protectedinherited

◆ handleStopRequest()

void AsyncJob::handleStopRequest ( )
inlineinherited

Definition at line 71 of file AsyncJob.h.

References AsyncJob::mustStop().

◆ 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 ClientHttpRequest::startAdaptation(), and Client::startAdaptation().

◆ initReadBuf()

void Client::initReadBuf ( )
protected

Definition at line 219 of file FtpClient.cc.

References MemBuf::init(), and NULL.

Referenced by Ftp::Gateway::Gateway().

◆ markParsedVirginReplyAsWhole()

void Client::markParsedVirginReplyAsWhole ( const char *  reasonWeAreSure)
inherited

remember that the received virgin reply was parsed in its entirety, including its body (if any)

Definition at line 159 of file Client.cc.

References assert, debugs, Client::fwd, FwdState::markStoredReplyAsWhole(), and Client::startedAdaptation.

Referenced by HttpStateData::decodeAndWriteReplyBody(), ftpReadTransferDone(), and HttpStateData::writeReplyBody().

◆ maybePurgeOthers()

◆ maybeReadVirginBody()

void Client::maybeReadVirginBody ( )
virtual

◆ mayReadVirginReplyBody()

virtual bool Client::mayReadVirginReplyBody ( ) const
protectedpure virtualinherited

◆ 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 958 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 ( )

Definition at line 793 of file FtpClient.cc.

◆ originalRequest()

◆ parseControlReply()

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

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

Definition at line 1085 of file FtpClient.cc.

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

◆ processReplyBody()

virtual void Client::processReplyBody ( )
pure virtualinherited

◆ readControlReply()

◆ replyBodySpace()

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

◆ resumeBodyStorage()

◆ scheduleReadControlReply()

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

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 323 of file FtpClient.cc.

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

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

◆ sendBodyIsTooLargeError()

void Client::sendBodyIsTooLargeError ( )
privateinherited

◆ sendEprt()

◆ sendMoreRequestBody()

◆ sendPassive()

bool Client::sendPassive ( )
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 651 of file FtpClient.cc.

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

Referenced by ftpSendPassive().

◆ sendPort()

bool Client::sendPort ( )

Definition at line 644 of file FtpClient.cc.

References ERR_FTP_FAILURE.

◆ sentRequestBody()

void Client::sentRequestBody ( const CommIoCbParams io)
protectedvirtual

◆ serverComplete()

◆ serverComplete2()

void Client::serverComplete2 ( )
privateinherited

◆ setFinalReply()

◆ setVirginReply()

HttpReply * Client::setVirginReply ( HttpReply r)
protectedinherited

◆ start()

void Client::start ( )
protectedvirtual

Reimplemented from AsyncJob.

Reimplemented in Ftp::Relay, and Ftp::Gateway.

Definition at line 213 of file FtpClient.cc.

Referenced by Ftp::Gateway::start(), and Ftp::Relay::start().

◆ Start()

◆ startAdaptation()

◆ startRequestBodyFlow()

bool Client::startRequestBodyFlow ( )
protectedinherited

◆ status()

◆ stopConsumingFrom()

◆ stopProducingFor()

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

◆ storeReplyBody()

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

Definition at line 1046 of file Client.cc.

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

Referenced by Client::addVirginReplyBody().

◆ swanSong()

◆ switchTimeoutToDataChannel()

void Ftp::Client::switchTimeoutToDataChannel ( )

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

Definition at line 1049 of file FtpClient.cc.

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

Referenced by ftpReadList(), and ftpReadRetr().

◆ timeout()

void Client::timeout ( const CommTimeoutCbParams io)
virtual

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

◆ virginReply() [1/2]

HttpReply * Client::virginReply ( )
protectedinherited

Definition at line 103 of file Client.cc.

References assert, and Client::theVirginReply.

◆ virginReply() [2/2]

◆ writeCommand()

◆ writeCommandCallback()

Member Data Documentation

◆ adaptationAccessCheckPending

◆ adaptedBodySource

◆ adaptedHeadSource

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

to get adapted response headers

Definition at line 178 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 90 of file Client.h.

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

◆ ctrl

◆ currentOffset

int64_t Client::currentOffset = 0
protectedinherited

◆ data

DataChannel Ftp::Client::data

◆ dataConnWait

JobWait<Comm::ConnOpener> Ftp::Client::dataConnWait
protected

Waits for an FTP data connection to the server to be established/opened. This wait only happens in FTP passive mode (via PASV or EPSV).

Definition at line 209 of file FtpClient.h.

◆ 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 191 of file Client.h.

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

◆ entry

◆ ftp_state_t

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

◆ fwd

◆ id

const InstanceId<AsyncJob> AsyncJob::id
inherited

Definition at line 73 of file AsyncJob.h.

◆ inCall

AsyncCall::Pointer AsyncJob::inCall
protectedinherited

◆ old_reply

char* Ftp::Client::old_reply

Definition at line 178 of file FtpClient.h.

Referenced by ftpSendReply().

◆ old_request

char* Ftp::Client::old_request

Definition at line 177 of file FtpClient.h.

Referenced by ftpSendReply().

◆ receivedWholeAdaptedReply

bool Client::receivedWholeAdaptedReply = false
protectedinherited

◆ receivedWholeRequestBody

bool Client::receivedWholeRequestBody = false
protectedinherited

◆ request

◆ requestBodySource

◆ requestSender

◆ responseBodyBuffer

MemBuf* Client::responseBodyBuffer = nullptr
protectedinherited

◆ shortenReadTimeout

bool Ftp::Client::shortenReadTimeout
private

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 216 of file FtpClient.h.

◆ started_

bool AsyncJob::started_ = false
protectedinherited

Definition at line 83 of file AsyncJob.h.

Referenced by AsyncJob::~AsyncJob(), AsyncJob::callEnd(), and AsyncJob::Start().

◆ startedAdaptation

bool Client::startedAdaptation = false
protectedinherited

◆ state

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ swanSang_

bool AsyncJob::swanSang_ = false
protectedinherited

Definition at line 84 of file AsyncJob.h.

Referenced by AsyncJob::~AsyncJob(), and AsyncJob::callEnd().

◆ theFinalReply

HttpReply* Client::theFinalReply = nullptr
privateinherited

adapted reply from ICAP or virgin reply

Definition at line 198 of file Client.h.

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

◆ theVirginReply

HttpReply* Client::theVirginReply = nullptr
privateinherited

reply received from the origin server

Definition at line 197 of file Client.h.

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

◆ typeName

◆ virginBodyDestination


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors