Inheritance diagram for Ftp::Gateway:
Collaboration diagram for Ftp::Gateway:

Public Types

enum  {
typedef CbcPointer< AsyncJobPointer
typedef CbcPointer< BodyProducerPointer
typedef CbcPointer< BodyConsumerPointer

Public Member Functions

 Gateway (FwdState *)
 ~Gateway () override
void start () override
 called by AsyncStart; do not call directly More...
Http::StatusCode failedHttpStatus (err_type &error) override
int restartable ()
void appendSuccessHeader ()
void hackShortcut (StateMethod *nextState)
void unhack ()
void readStor ()
void parseListing ()
bool htmlifyListEntry (const char *line, PackableStream &)
void completedListing (void)
void listenForDataChannel (const Comm::ConnectionPointer &conn)
 create a data channel acceptor and start listening. More...
int checkAuth (const HttpHeader *req_hdr)
void checkUrlpath ()
void buildTitleUrl ()
void writeReplyBody (const char *, size_t len)
void completeForwarding () override
void processHeadResponse ()
void processReplyBody () override
void setCurrentOffset (int64_t offset)
int64_t getCurrentOffset () const
void dataChannelConnected (const CommConnectCbParams &io) override
void timeout (const CommTimeoutCbParams &io) override
 read timeout handler More...
void ftpAcceptDataConnection (const CommAcceptCbParams &io)
SBuf ftpRealm ()
void loginFailed (void)
void haveParsedReplyHeaders () override
 called when we have final (possibly adapted) reply headers; kids extend More...
virtual bool haveControlChannel (const char *caller_name) const
virtual void failed (err_type error=ERR_NONE, int xerrno=0, ErrorState *ftperr=nullptr)
 handle a fatal transaction error, closing the control connection More...
void maybeReadVirginBody () override
 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 ()
void noteMoreBodyDataAvailable (BodyPipe::Pointer) override
void noteBodyProductionEnded (BodyPipe::Pointer) override
void noteBodyProducerAborted (BodyPipe::Pointer) override
virtual bool abortOnData (const char *reason)
virtual HttpRequestPointer originalRequest ()
 a hack to reach HttpStateData::orignal_request More...
void noteAdaptationAnswer (const Adaptation::Answer &answer) override
void noteAdaptationAclCheckDone (Adaptation::ServiceGroupPointer group) override
void noteMoreBodySpaceAvailable (BodyPipe::Pointer) override
void noteBodyConsumerAborted (BodyPipe::Pointer) override
virtual bool getMoreRequestBody (MemBuf &buf)
 either fill buf with available [encoded] request body bytes or return false More...
void swanSong () override
bool doneAll () const override
 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 HttpReplyftpAuthRequired (HttpRequest *request, SBuf &realm, AccessLogEntry::Pointer &)
static void Start (const Pointer &job)
static void RegisterWithCacheManager ()

Public Attributes

char user [MAX_URL]
char password [MAX_URL]
int password_url
char * reply_hdr
int reply_hdr_state
String clean_url
String title_url
String base_href
int conn_att
int login_att
time_t mdtm
int64_t theSize
char * filepath
char * dirpath
int64_t restart_offset
char * proxy_host
size_t list_width
String cwd_message
char * old_filepath
char typecode
MemBuf listing
 FTP directory listing in HTML format. More...
GatewayFlags flags
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...

Static Public Attributes

static PF ftpDataWrite

Protected Member Functions

void handleControlReply () override
void dataClosed (const CommCloseCbParams &io) override
 handler called by Comm when FTP data channel is closed unexpectedly More...
void closeServer () override
bool doneWithServer () const override
const Comm::ConnectionPointerdataConnection () const override
void abortAll (const char *reason) override
 abnormal transaction termination; reason is for debugging only More...
void noteDelayAwareReadChance () override
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...
void initReadBuf ()
void sentRequestBody (const CommIoCbParams &io) override
void doneSendingRequestBody () override
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...
void delayRead ()
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 ReportAllJobs (StoreEntry *)
 writes a cache manager report about all jobs existing in this worker More...

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

bool mayReadVirginReplyBody () const override
 whether we may receive more virgin response body bytes More...
void handleRequestBodyProducerAborted () override
void loginParser (const SBuf &login, bool escaped)
bool parseControlReply (size_t &bytesUsed)
void serverComplete2 ()
void sendBodyIsTooLargeError ()
void maybePurgeOthers ()
virtual void finalizedInCbdataChild ()=0
 hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More...

Private Attributes

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

Detailed Description

FTP Gateway: An FTP client that takes an HTTP request with an ftp:// URI, converts it into one or more FTP commands, and then converts one or more FTP responses into the final HTTP response.

Definition at line 94 of file

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

Definition at line 145 of file FtpClient.h.

Constructor & Destructor Documentation

◆ Gateway()

◆ ~Gateway()

Ftp::Gateway::~Gateway ( )

Member Function Documentation

◆ abortAll()

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

Implements Client.

Definition at line 1053 of file

References debugs.

◆ abortOnBadEntry()

◆ abortOnData()

bool Client::abortOnData ( const char *  reason)

abnormal data transfer termination

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

Reimplemented in Ftp::Relay.

Definition at line 311 of file

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 

◆ addVirginReplyBody()

◆ adjustBodyBytesRead()

void Client::adjustBodyBytesRead ( const int64_t  delta)

◆ announceInitiatorAbort()

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

Definition at line 38 of file

References CallJobHere.

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

◆ appendSuccessHeader()

◆ blockCaching()

◆ buildTitleUrl()

void Ftp::Gateway::buildTitleUrl ( )

◆ calcBufferSpaceToReserve()

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

◆ callEnd()

void AsyncJob::callEnd ( )

◆ callException()

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const

Definition at line 117 of file

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


Ftp::Gateway::CBDATA_CHILD ( Gateway  )



◆ checkAuth()

int Ftp::Gateway::checkAuth ( const HttpHeader req_hdr)

Locates the FTP user:password login.

Highest to lowest priority:

Special Case: A username-only may be provided in the URL and password in the HTTP headers.

TODO: we might be able to do something about locating username from other sources: ie, external ACL user=* tag or ident lookup

Return values
1if we have everything needed to complete this request.
0if something is missing.

Definition at line 1025 of file

References SquidConfig::anon_user, Http::AUTHORIZATION, Config, fatal(), SquidConfig::Ftp, HttpHeader::getAuthToken(), MAX_URL, null_string, and xstrncpy().

◆ checkUrlpath()

void Ftp::Gateway::checkUrlpath ( )

Definition at line 1071 of file

References SBuf::length(), SBuf::npos, and xtoupper.

◆ cleanAdaptation()

◆ clearAdaptation()

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

◆ closeServer()

void Ftp::Client::closeServer ( )

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

Implements Client.

Definition at line 233 of file

References debugs, and Comm::IsConnOpen().

◆ completedListing()

void Ftp::Gateway::completedListing ( void  )

Generate the HTTP headers and template fluff around an FTP directory listing display.

Definition at line 2212 of file

References assert, ErrorState::BuildHttpReply(), ErrorState::cwd_msg, ERR_DIR_LISTING, ErrorState::ftp, ErrorState::listing, Http::scOkay, ErrorState::server_msg, and xstrdup.

Referenced by ftpReadTransferDone().

◆ completeForwarding()

void Ftp::Gateway::completeForwarding ( )

A hack to ensure we do not double-complete on the forward entry.

TODO: Ftp::Gateway logic should probably be rewritten to avoid double-completion or FwdState should be rewritten to allow it.

Reimplemented from Client.

Definition at line 2632 of file

References Client::completeForwarding(), and debugs.

◆ connectDataChannel()

void Ftp::Client::connectDataChannel ( )

◆ ctrlClosed()

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

Definition at line 879 of file

References debugs.

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

◆ dataChannelConnected()

void Ftp::Gateway::dataChannelConnected ( const CommConnectCbParams io)

◆ dataClosed()

void Ftp::Gateway::dataClosed ( const CommCloseCbParams io)

Reimplemented from Ftp::Client.

Definition at line 316 of file

References Ftp::Client::dataClosed(), ERR_FTP_FAILURE, and Ftp::Client::failed().

◆ dataCloser()

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

Definition at line 802 of file

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

◆ dataComplete()

void Client::dataComplete ( )

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

Definition at line 1024 of file

References debugs.

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

◆ dataConnection()

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

Implements Client.

Definition at line 902 of file

◆ dataRead()

◆ delayRead()

void Client::delayRead ( )

Defer reading until it is likely to become possible. Eventually, noteDelayAwareReadChance() will be called.

Definition at line 1029 of file

References asyncCall(), MemObject::delayRead(), Client::entry, StoreEntry::mem(), and Client::noteDelayAwareReadChance().

Referenced by HttpStateData::readReply().

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)

◆ done()

bool AsyncJob::done ( ) const

◆ doneAll()

bool Client::doneAll ( ) const

Reimplemented from AsyncJob.

Definition at line 217 of file

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

◆ doneSendingRequestBody()

void Ftp::Client::doneSendingRequestBody ( )

called after we wrote the last byte of the request body

Implements Client.

Definition at line 1087 of file

References debugs, and Client::doneSendingRequestBody().

◆ doneWithAdaptation()

bool Client::doneWithAdaptation ( ) const

◆ doneWithServer()

bool Ftp::Client::doneWithServer ( ) const

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 256 of file

References Comm::IsConnOpen().

◆ endAdaptedBodyConsumption()

◆ failed()

◆ failedHttpStatus()

Http::StatusCode Ftp::Gateway::failedHttpStatus ( err_type error)

◆ finalizedInCbdataChild()

virtual void CbdataParent::finalizedInCbdataChild ( )
privatepure virtualinherited

◆ finalReply()

HttpReply * Client::finalReply ( )

Definition at line 129 of file

References assert, and Client::theFinalReply.

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

◆ ftpAcceptDataConnection()

void Ftp::Gateway::ftpAcceptDataConnection ( const CommAcceptCbParams io)

"read" handler to accept FTP data connections.

iocomm accept(2) callback parameters
When squid.conf ftp_sanitycheck is enabled, check the new connection is actually being made by the remote client which is connected to the FTP control socket. Or the one which we were told to listen for by control channel messages (may differ under NAT). This prevents third-party hacks, but also third-party load balancing handshakes.

On Comm::OK start using the accepted data socket and discard the temporary listen socket.

Definition at line 1873 of file

References assert, Comm::Connection::close(), Config, CommCommonCbParams::conn, DBG_IMPORTANT, debugs, EBIT_TEST, ENTRY_ABORTED, fd_table, CommCommonCbParams::flag, SquidConfig::Ftp, ftpFail, Comm::IsConnOpen(), MYNAME, Comm::OK, Comm::Connection::remote, SquidConfig::sanitycheck, CommCommonCbParams::xerrno, and xstrerr().

Referenced by listenForDataChannel().

◆ ftpAuthRequired()

HttpReply * Ftp::Gateway::ftpAuthRequired ( HttpRequest request,
SBuf realm,
AccessLogEntry::Pointer ale 

◆ ftpRealm()

SBuf Ftp::Gateway::ftpRealm ( )

Definition at line 1259 of file

References SBuf::append(), and SBuf::appendf().

◆ getCurrentOffset()

int64_t Ftp::Gateway::getCurrentOffset ( ) const

Definition at line 150 of file

References Client::currentOffset.

◆ getMoreRequestBody()

bool Client::getMoreRequestBody ( MemBuf buf)

◆ hackShortcut()

void Ftp::Gateway::hackShortcut ( StateMethod nextState)

Definition at line 2334 of file

References debugs, MYNAME, and xstrdup.

Referenced by ftpFail(), and ftpReadRetr().

◆ handleAdaptationAborted()

void Client::handleAdaptationAborted ( bool  bypassable = false)

◆ handleAdaptationBlocked()

◆ handleAdaptationCompleted()

◆ handleAdaptedBodyProducerAborted()

◆ handleAdaptedBodyProductionEnded()

void Client::handleAdaptedBodyProductionEnded ( )

◆ handleAdaptedHeader()

◆ handleControlReply()

void Ftp::Gateway::handleControlReply ( )

Reimplemented from Ftp::Client.

Definition at line 1164 of file

References FTP_SM_FUNCS, Ftp::Client::handleControlReply(), and wordlist::next.

◆ handledEarlyAdaptationAbort()

bool Client::handledEarlyAdaptationAbort ( )

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 901 of file

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

◆ 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 455 of file

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

Referenced by ftpReadPasv().

◆ handleRequestBodyProducerAborted()

void Ftp::Gateway::handleRequestBodyProducerAborted ( )

Implements Client.

Definition at line 2250 of file

References debugs, ERR_READ_ERROR, and Client::handleRequestBodyProducerAborted().

◆ handleRequestBodyProductionEnded()

void Client::handleRequestBodyProductionEnded ( )

◆ handleStopRequest()

void AsyncJob::handleStopRequest ( )

Definition at line 73 of file AsyncJob.h.

References AsyncJob::mustStop().

◆ haveControlChannel()

bool Ftp::Gateway::haveControlChannel ( const char *  caller_name) const

Have we lost the FTP server control channel?

Return values
trueThe server control channel is available.
falseThe server control channel is not available.

Definition at line 2652 of file

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

Referenced by ftpSendCwd(), ftpSendList(), ftpSendMdtm(), ftpSendMkdir(), ftpSendNlst(), ftpSendPass(), ftpSendPassive(), ftpSendPORT(), ftpSendQuit(), ftpSendRest(), ftpSendRetr(), ftpSendSize(), ftpSendStor(), ftpSendType(), and ftpSendUser().

◆ haveParsedReplyHeaders()

void Ftp::Gateway::haveParsedReplyHeaders ( )

called when got final headers

Reimplemented from Client.

Definition at line 2562 of file

References Client::haveParsedReplyHeaders(), StoreEntry::makePublic(), StoreEntry::release(), and StoreEntry::timestampsSet().

◆ htmlifyListEntry()

◆ initiateAdaptation()

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

◆ initiated()

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

Definition at line 52 of file Initiator.h.

References CbcPointer< Cbc >::set().

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

◆ initReadBuf()

void Client::initReadBuf ( )

Definition at line 221 of file

References MemBuf::init().

Referenced by Gateway().

◆ listenForDataChannel()

void Ftp::Gateway::listenForDataChannel ( const Comm::ConnectionPointer conn)

◆ loginFailed()

void Ftp::Gateway::loginFailed ( void  )

Translate FTP login failure into HTTP error this is an attmpt to get the 407 message to show up outside Squid. its NOT a general failure. But a correct FTP response type.

Definition at line 1215 of file

References ErrorState::BuildHttpReply(), SBuf::c_str(), ERR_FTP_FORBIDDEN, ERR_FTP_UNAVAILABLE, ERR_NONE, ftpFail, Http::Message::header, HttpHeader::putAuth(), Http::scForbidden, Http::scServiceUnavailable, and Http::scUnauthorized.

Referenced by ftpReadPass(), and ftpReadUser().

◆ loginParser()

void Ftp::Gateway::loginParser ( const SBuf login,
bool  escaped 

Parse a possible login username:password pair. Produces filled member variables user, password, password_url if anything found.

logina decoded Basic authentication credential token or URI user-info token
escapedwhether to URL-decode the token after extracting user and password

Definition at line 397 of file

References SBuf::copy(), debugs, SBuf::find(), SBuf::isEmpty(), SBuf::length(), SBuf::npos, rfc1738_unescape(), and SBuf::substr().

◆ markParsedVirginReplyAsWhole()

void Client::markParsedVirginReplyAsWhole ( const char *  reasonWeAreSure)

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

Definition at line 158 of file

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

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

◆ maybePurgeOthers()

◆ maybeReadVirginBody()

void Client::maybeReadVirginBody ( )

◆ mayReadVirginReplyBody()

bool Ftp::Gateway::mayReadVirginReplyBody ( ) const

Implements Client.

Definition at line 2668 of file

◆ mustStop()

◆ noteAdaptationAclCheckDone()

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

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 957 of file

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

◆ noteAdaptationAnswer()

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

◆ noteBodyConsumerAborted()

void Client::noteBodyConsumerAborted ( BodyPipe::Pointer  )

◆ noteBodyProducerAborted()

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

◆ noteBodyProductionEnded()

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

◆ noteDelayAwareReadChance()

void Client::noteDelayAwareReadChance ( )

Called when a previously delayed dataConnection() read may be possible.

See also

Implements Client.

Definition at line 908 of file

◆ noteMoreBodyDataAvailable()

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

◆ noteMoreBodySpaceAvailable()

void Client::noteMoreBodySpaceAvailable ( BodyPipe::Pointer  )

◆ openListenSocket()

bool Client::openListenSocket ( )

Definition at line 795 of file

◆ originalRequest()

◆ parseControlReply()

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

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

Definition at line 1101 of file

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

◆ parseListing()

void Ftp::Gateway::parseListing ( )

◆ processHeadResponse()

void Ftp::Gateway::processHeadResponse ( )

Definition at line 1680 of file

References debugs, EBIT_TEST, ENTRY_ABORTED, and ftpSendQuit.

Referenced by ftpSendPassive().

◆ processReplyBody()

void Ftp::Gateway::processReplyBody ( )

Implements Client.

Definition at line 958 of file

References debugs, EBIT_TEST, ENTRY_ABORTED, and Http::METHOD_HEAD.

◆ readControlReply()

◆ readStor()

void Ftp::Gateway::readStor ( )

Definition at line 2004 of file

References code, DBG_IMPORTANT, debugs, ftpFail, Comm::IsConnOpen(), and MYNAME.

Referenced by ftpReadStor().

◆ RegisterWithCacheManager()

void AsyncJob::RegisterWithCacheManager ( )

Definition at line 215 of file

References Mgr::RegisterAction(), and AsyncJob::ReportAllJobs().

Referenced by mainInitialize().

◆ replyBodySpace()

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

◆ ReportAllJobs()

void AsyncJob::ReportAllJobs ( StoreEntry e)

Definition at line 198 of file

References AllJobs().

Referenced by AsyncJob::RegisterWithCacheManager().

◆ restartable()

int Ftp::Gateway::restartable ( )

Definition at line 2054 of file

Referenced by ftpRestOrList().

◆ resumeBodyStorage()

◆ scheduleReadControlReply()

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

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 325 of file

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

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

◆ sendBodyIsTooLargeError()

void Client::sendBodyIsTooLargeError ( )

◆ 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 653 of file

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, SquidConfig::passive, MemBuf::reset(), and wordlistDestroy().

Referenced by ftpSendPassive().

◆ sendPort()

bool Client::sendPort ( )

Definition at line 646 of file


◆ sentRequestBody()

void Client::sentRequestBody ( const CommIoCbParams io)

◆ serverComplete()

◆ serverComplete2()

void Client::serverComplete2 ( )

◆ setCurrentOffset()

void Ftp::Gateway::setCurrentOffset ( int64_t  offset)

Definition at line 149 of file

References Client::currentOffset.

Referenced by ftpReadRest().

◆ setFinalReply()

◆ setVirginReply()

HttpReply * Client::setVirginReply ( HttpReply r)

◆ start()

void Ftp::Gateway::start ( )

Reimplemented from Ftp::Client.

Definition at line 1142 of file

References debugs, and Ftp::Client::start().

◆ Start()

◆ startAdaptation()

◆ startRequestBodyFlow()

bool Client::startRequestBodyFlow ( )

◆ status()

◆ stopConsumingFrom()

◆ stopProducingFor()

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

◆ storeReplyBody()

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

Definition at line 1054 of file

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 1065 of file

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

Referenced by ftpReadList(), and ftpReadRetr().

◆ timeout()

void Ftp::Gateway::timeout ( const CommTimeoutCbParams io)

Reimplemented from Ftp::Client.

Definition at line 480 of file

References DBG_IMPORTANT, debugs, and Ftp::Client::timeout().

◆ toCbdata()

virtual void * CbdataParent::toCbdata ( )
pure virtualinherited

◆ unhack()

void Ftp::Gateway::unhack ( )

Forget hack status. Next error is shown to the user

Definition at line 2323 of file

References debugs, MYNAME, and safe_free.

Referenced by ftpReadCwd(), ftpReadMdtm(), and ftpReadSize().

◆ virginReply() [1/2]

HttpReply * Client::virginReply ( )

Definition at line 102 of file

References assert, and Client::theVirginReply.

◆ virginReply() [2/2]

◆ writeCommand()

◆ writeCommandCallback()

◆ writeReplyBody()

void Ftp::Gateway::writeReplyBody ( const char *  dataToWrite,
size_t  dataLength 

Call this when there is data from the origin server which should be sent to either StoreEntry, or to ICAP...

Definition at line 2619 of file

References debugs.

Member Data Documentation

◆ adaptationAccessCheckPending

bool Client::adaptationAccessCheckPending = false

◆ adaptedBodySource

◆ adaptedHeadSource

CbcPointer<Adaptation::Initiate> Client::adaptedHeadSource

to get adapted response headers

Definition at line 186 of file Client.h.

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

◆ base_href

String Ftp::Gateway::base_href

Definition at line 108 of file

◆ clean_url

String Ftp::Gateway::clean_url

Definition at line 106 of file

◆ completed

bool Client::completed = false

serverComplete() has been called

Definition at line 90 of file Client.h.

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

◆ conn_att

int Ftp::Gateway::conn_att

Definition at line 109 of file

◆ ctrl

◆ currentOffset

int64_t Client::currentOffset = 0

◆ cwd_message

String Ftp::Gateway::cwd_message

Definition at line 119 of file

Referenced by ftpReadCwd().

◆ data

DataChannel Ftp::Client::data

◆ dataConnWait

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

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

◆ dirpath

char* Ftp::Gateway::dirpath

Definition at line 115 of file

Referenced by ftpTraverseDirectory().

◆ doneWithFwd

const char* Client::doneWithFwd = nullptr

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

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

◆ entry

◆ filepath

◆ flags


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

◆ ftpDataWrite

PF Ftp::Gateway::ftpDataWrite

Definition at line 153 of file

◆ fwd

◆ id

const InstanceId<AsyncJob> AsyncJob::id

Definition at line 75 of file AsyncJob.h.

◆ inCall

AsyncCall::Pointer AsyncJob::inCall

◆ list_width

size_t Ftp::Gateway::list_width

Definition at line 118 of file

◆ listing

MemBuf Ftp::Gateway::listing

Definition at line 122 of file

◆ login_att

int Ftp::Gateway::login_att

Definition at line 110 of file

Referenced by ftpReadWelcome().

◆ mdtm

time_t Ftp::Gateway::mdtm

Definition at line 111 of file

Referenced by ftpFail(), ftpReadMdtm(), and ftpSendReply().

◆ old_filepath

char* Ftp::Gateway::old_filepath

Definition at line 120 of file

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

◆ password

char Ftp::Gateway::password[MAX_URL]

Definition at line 102 of file

Referenced by Gateway(), and ftpSendPass().

◆ password_url

int Ftp::Gateway::password_url

Definition at line 103 of file

◆ pathcomps

wordlist* Ftp::Gateway::pathcomps

Definition at line 113 of file

Referenced by ftpReadType(), ftpTraverseDirectory(), and ftpTrySlashHack().

◆ proxy_host

char* Ftp::Gateway::proxy_host

Definition at line 117 of file

Referenced by ftpSendUser().

◆ receivedWholeAdaptedReply

bool Client::receivedWholeAdaptedReply = false

◆ receivedWholeRequestBody

bool Client::receivedWholeRequestBody = false

◆ reply_hdr

char* Ftp::Gateway::reply_hdr

Definition at line 104 of file

◆ reply_hdr_state

int Ftp::Gateway::reply_hdr_state

Definition at line 105 of file

◆ request

◆ requestBodySource

◆ requestSender

◆ responseBodyBuffer

MemBuf* Client::responseBodyBuffer = nullptr

◆ restart_offset

int64_t Ftp::Gateway::restart_offset

Definition at line 116 of file

Referenced by ftpReadRest(), and ftpSendRest().

◆ shortenReadTimeout

bool Ftp::Client::shortenReadTimeout

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

Definition at line 217 of file FtpClient.h.

◆ started_

bool AsyncJob::started_ = false

Definition at line 88 of file AsyncJob.h.

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

◆ startedAdaptation

bool Client::startedAdaptation = false

◆ state

◆ stopReason

const char* AsyncJob::stopReason

◆ swanSang_

bool AsyncJob::swanSang_ = false

Definition at line 89 of file AsyncJob.h.

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

◆ theFinalReply

HttpReply* Client::theFinalReply = nullptr

adapted reply from ICAP or virgin reply

Definition at line 206 of file Client.h.

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

◆ theSize

int64_t Ftp::Gateway::theSize

Definition at line 112 of file

Referenced by ftpFail(), ftpReadSize(), and ftpSendPassive().

◆ theVirginReply

HttpReply* Client::theVirginReply = nullptr

reply received from the origin server

Definition at line 205 of file Client.h.

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

◆ title_url

String Ftp::Gateway::title_url

Definition at line 107 of file

Referenced by ftpListDir(), and ftpReadSize().

◆ typecode

char Ftp::Gateway::typecode

Definition at line 121 of file

Referenced by ftpRestOrList(), and ftpSendType().

◆ typeName

◆ user

char Ftp::Gateway::user[MAX_URL]

Definition at line 101 of file

Referenced by Gateway(), and ftpSendUser().

◆ virginBodyDestination

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






Web Site Translations