FtpServer.cc
Go to the documentation of this file.
743 request->http_ver = Http::ProtocolVersion(Ftp::ProtocolVersion().major, Ftp::ProtocolVersion().minor);
1107 mb.appendf("%i-Error-Detail-Brief: " SQUIDSBUFPH "\r\n", scode, SQUIDSBUFPRINT(detail->brief()));
1108 mb.appendf("%i-Error-Detail-Verbose: " SQUIDSBUFPH "\r\n", scode, SQUIDSBUFPRINT(detail->verbose(request)));
1542 ACLFilledChecklist bodyContinuationCheck(Config.accessList.forceRequestBodyContinuation, request);
bool handleEprtRequest(String &cmd, String ¶ms)
Definition: FtpServer.cc:1567
Definition: parse.c:104
Definition: AsyncJob.h:31
void wroteEarlyReply(const CommIoCbParams &io)
Definition: FtpServer.cc:1234
virtual void clientPinnedConnectionClosed(const CommCloseCbParams &io)
Our close handler called by Comm when the pinned connection is closed.
Definition: client_side.cc:3660
Http::Stream * handleUserRequest(const SBuf &cmd, SBuf ¶ms)
Definition: FtpServer.cc:1358
static HttpRequest * FromUrl(const SBuf &url, const MasterXaction::Pointer &, const HttpRequestMethod &method=Http::METHOD_GET)
Definition: HttpRequest.cc:517
Definition: FilledChecklist.h:33
void appendf(const char *fmt,...) PRINTF_FORMAT_ARG2
Append operation with printf-style arguments.
Definition: Packable.h:61
Definition: CommCalls.h:92
Definition: AsyncCall.h:124
HttpHeader allMeta
All REQMOD and RESPMOD meta headers merged. Last field wins conflicts.
Definition: History.h:63
struct SquidConfig::@98 accessList
AnyP::ProtocolVersion ProtocolVersion()
Protocol version to use in Http::Message structures wrapping FTP messages.
Definition: Elements.cc:24
void handleDataReply(const HttpReply *header, StoreIOBuffer receivedData)
Definition: FtpServer.cc:943
bool ParseProtoIpPort(const char *buf, Ip::Address &addr)
Definition: Parsing.cc:52
void initRequest(HttpRequest *)
Definition: client_side_request.cc:1511
Transaction information shared among our FTP client and server jobs.
Definition: FtpServer.h:42
static bool SupportedCommand(const SBuf &name)
Whether Squid FTP Relay supports a named feature (e.g., a command).
Definition: FtpServer.cc:1842
void setAddrs(const Ip::Address &aLocal, const Ip::Address &aRemote)
Definition: Connection.h:106
AnyP::PortCfgPointer port
the configuration listening port this call relates to (may be nil)
Definition: CommCalls.h:100
void createStoreEntry(const HttpRequestMethod &m, RequestFlags flags)
Definition: client_side_reply.cc:2064
static void PrintReply(MemBuf &mb, const HttpReply *reply, const char *const prefix="")
Definition: FtpServer.cc:1213
static void AcceptCtrlConnection(const CommAcceptCbParams ¶ms)
accept a new FTP control connection and hand it to a dedicated Server
Definition: FtpServer.cc:242
void clientStartListeningOn(AnyP::PortCfgPointer &port, const RefCount< CommCbFunPtrCallT< CommAcceptCbPtrFun > > &subCall, const Ipc::FdNoteId fdNote)
accept requests to a given port and inform subCall about them
Definition: client_side.cc:3293
int pipelinePrefetchMax() const override
returning N allows a pipeline of 1+N requests (see pipeline_prefetch)
Definition: FtpServer.cc:80
CBDATA_NAMESPACED_CLASS_INIT(Ftp, Server)
bool handlePortRequest(String &cmd, String ¶ms)
Definition: FtpServer.cc:1491
void writeForwardedForeign(const HttpReply *reply)
Definition: FtpServer.cc:1143
HttpReply * HttpReplyWrapper(const int ftpStatus, const char *ftpReason, const Http::StatusCode httpStatus, const int64_t clen)
Create an internal HttpReply structure to house FTP control response info.
Definition: Elements.cc:30
bool handleCwdRequest(String &cmd, String ¶ms)
Definition: FtpServer.cc:1621
CharacterSet complement(const char *complementLabel=nullptr) const
Definition: CharacterSet.cc:74
Definition: ConnOpener.h:24
Definition: Server.h:31
Definition: AsyncJob.h:17
void noteBodyConsumerAborted(BodyPipe::Pointer) override=0
Definition: client_side.cc:2067
bool handleFeatRequest(String &cmd, String ¶ms)
Definition: FtpServer.cc:1406
void wroteReplyData(const CommIoCbParams &io)
called when we are done writing a chunk of the response data
Definition: FtpServer.cc:986
struct ConnStateData::@35 flags
AccessLogEntry::Pointer al
info for the future access.log, and external ACL
Definition: FilledChecklist.h:124
void handleFeatReply(const HttpReply *header, StoreIOBuffer receivedData)
Definition: FtpServer.cc:812
void updateOrAddStr(Http::HdrType, const SBuf &)
Definition: HttpHeader.cc:1083
void replaceHttpReply(const HttpReplyPointer &, const bool andStartWriting=true)
Definition: store.cc:1705
void writeForwardedReply(const HttpReply *reply)
Definition: FtpServer.cc:1036
bool handlePasvRequest(String &cmd, String ¶ms)
Definition: FtpServer.cc:1413
Definition: CommCalls.h:280
struct StatCounters::@111 client_http
void handleEprtReply(const HttpReply *header, StoreIOBuffer receivedData)
Definition: FtpServer.cc:1059
void shovelUploadData()
shovel upload data from the internal buffer to the body pipe if possible
Definition: FtpServer.cc:202
void syncAle(HttpRequest *adaptedRequest, const char *logUri) const override
assigns uninitialized adapted_request and url ALE components
Definition: FilledChecklist.cc:110
#define TexcHere(msg)
legacy convenience macro; it is not difficult to type Here() now
Definition: TextException.h:63
static bool Enabled(const int section, const int level)
whether debugging the given section and the given level produces output
Definition: Stream.h:75
Definition: forward.h:23
bool createDataConnection(Ip::Address cltAddr)
[Re]initializes dataConn for active data transfers. Does not connect.
Definition: FtpServer.cc:1432
Definition: clientStream.h:75
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:25
static void Reset()
forgets the current context, setting it to nil/unknown
Definition: CodeContext.cc:77
Definition: HttpHeader.h:50
void ReadCancel(int fd, AsyncCall::Pointer &callback)
Cancel the read pending on FD. No action if none pending.
Definition: Read.cc:219
void comm_open_listener(int sock_type, int proto, Comm::ConnectionPointer &conn, const char *note)
Definition: comm.cc:257
time_t idleTimeout() const override
timeout to use when waiting for the next request
Definition: FtpServer.cc:86
void comm_read(const Comm::ConnectionPointer &conn, char *buf, int len, AsyncCall::Pointer &callback)
Definition: Read.h:59
Definition: HttpRequest.h:48
unsigned int toHostStr(char *buf, const unsigned int len) const
Definition: Address.cc:862
bool handleDataRequest(String &cmd, String ¶ms)
Definition: FtpServer.cc:1520
void replyDataWritingCheckpoint()
ClientStream checks after (actual or skipped) reply data writing.
Definition: FtpServer.cc:1004
void writeErrorReply(const HttpReply *reply, const int status)
writes FTP error response with given status and reply-derived error details
Definition: FtpServer.cc:1095
void leaveOrphanage()
resume relying on owner(s) to initiate an explicit connection closure
Definition: Connection.h:92
Definition: StoreIOBuffer.h:15
static bool CommandHasPathParameter(const SBuf &cmd)
whether the given FTP command has a pathname parameter
Definition: FtpServer.cc:544
Definition: client_side_request.h:30
Definition: RequestFlags.h:22
void calcUri(const SBuf *file)
computes uri member from host and, if tracked, working dir with file name
Definition: FtpServer.cc:345
Http::StatusCode status() const
retrieve the status code for this status line
Definition: StatusLine.h:45
void notePeerConnection(Comm::ConnectionPointer conn) override
called just before a FwdState-dispatched job starts using connection
Definition: FtpServer.cc:302
int httpHeaderParseQuotedString(const char *start, const int len, String *val)
Definition: HttpHeaderTools.cc:168
void handleReply(HttpReply *header, StoreIOBuffer receivedData) override
Definition: FtpServer.cc:778
void setReplyToReply(HttpReply *reply)
creates a store entry for the reply and appends error reply to it
Definition: client_side_reply.cc:132
Definition: client_side.h:79
Definition: MemBuf.h:23
Definition: CommCalls.h:113
void acceptDataConnection(const CommAcceptCbParams ¶ms)
Definition: FtpServer.cc:401
clientStreamNode * getClientReplyContext() const
Definition: Stream.cc:511
bool handleCdupRequest(String &cmd, String ¶ms)
Definition: FtpServer.cc:1635
Definition: RequestMethod.h:26
void maybeReadUploadData()
schedules another data connection read if needed
Definition: FtpServer.cc:109
void handleUploadReply(const HttpReply *header, StoreIOBuffer receivedData)
Definition: FtpServer.cc:1029
Http::Stream * earlyError(const EarlyErrorKind eek)
creates a context filled with an error message for a given early error
Definition: FtpServer.cc:570
#define CallJobHere(debugSection, debugLevel, job, Class, method)
Definition: AsyncJobCalls.h:59
void noteBodyConsumerAborted(BodyPipe::Pointer ptr) override
Definition: FtpServer.cc:231
CommCbFunPtrCallT< Dialer > * commCbCall(int debugSection, int debugLevel, const char *callName, const Dialer &dialer)
Definition: CommCalls.h:312
void userDataCompletionCheckpoint(int finalStatusCode)
Definition: FtpServer.cc:1809
Definition: SquidString.h:25
void callException(const std::exception &e) override
called when the job throws during an async call
Definition: FtpServer.cc:1750
Definition: CommCalls.h:165
#define JobCallback(dbgSection, dbgLevel, Dialer, job, method)
Convenience macro to create a Dialer-based job callback.
Definition: AsyncJobCalls.h:70
SBuf & trim(const SBuf &toRemove, bool atBeginning=true, bool atEnd=true)
Definition: SBuf.cc:551
Definition: TcpAcceptor.h:38
void Write(const Comm::ConnectionPointer &conn, const char *buf, int size, AsyncCall::Pointer &callback, FREE *free_func)
Definition: Write.cc:33
Definition: Tokenizer.h:29
Definition: client_side_reply.h:22
Adaptation::History::Pointer adaptHistory(bool createIfNone=false) const
Returns possibly nil history, creating it if requested.
Definition: HttpRequest.cc:404
void clientSetKeepaliveFlag(ClientHttpRequest *http)
decide whether to expect multiple requests on the corresponding connection
Definition: client_side.cc:674
Definition: CommCalls.h:104
unsigned int listenForDataConnection()
Definition: FtpServer.cc:370
void clientStreamInit(dlink_list *list, CSR *func, CSD *rdetach, CSS *readstatus, const ClientStreamData &readdata, CSCB *callback, CSD *cdetach, const ClientStreamData &callbackdata, StoreIOBuffer tailBuffer)
Definition: clientStream.cc:112
Definition: HttpReply.h:24
void clientProcessRequest(ConnStateData *conn, const Http1::RequestParserPointer &hp, Http::Stream *context)
Definition: client_side.cc:1568
acl_access * forceRequestBodyContinuation
Definition: SquidConfig.h:404
void handlePasvReply(const HttpReply *header, StoreIOBuffer receivedData)
Definition: FtpServer.cc:881
HttpHeaderEntry * findEntry(Http::HdrType id) const
Definition: HttpHeader.cc:602
const char * reason() const
retrieve the reason string for this status line
Definition: StatusLine.cc:44
bool ParseIpPort(const char *buf, const char *forceIp, Ip::Address &addr)
parses and validates "A1,A2,A3,A4,P1,P2" IP,port sequence
Definition: Parsing.cc:18
bool handlePassRequest(String &cmd, String ¶ms)
Definition: FtpServer.cc:1628
void readUploadData(const CommIoCbParams &io)
imports more upload data from the data connection
Definition: FtpServer.cc:168
Definition: parse.c:160
Definition: CommCalls.h:194
struct SquidConfig::@84 Timeout
bool forcedBodyContinuation
whether we have responded with HTTP 100 or FTP 150 already
Definition: HttpRequest.h:194
Definition: Stream.h:72
bool checkDataConnPost() const
Check that client data connection is ready for immediate I/O.
Definition: FtpServer.cc:1692
void writeEarlyReply(const int code, const char *msg)
Definition: FtpServer.cc:476
size_t req_sz
raw request size on input, not current request size
Definition: client_side_request.h:159
void setAnyAddr()
NOTE: Does NOT clear the Port stored. Only the Address and Type.
Definition: Address.cc:197
bool writeControlMsgAndCall(HttpReply *rep, AsyncCall::Pointer &call) override
handle a control message received by context from a peer and call back
Definition: FtpServer.cc:1152
Definition: CommCalls.h:127
void processParsedRequest(Http::StreamPointer &context) override
start processing a freshly parsed request
Definition: FtpServer.cc:156
struct Http::Stream::@65 flags
void writeForwardedReplyAndCall(const HttpReply *reply, AsyncCall::Pointer &call)
Definition: FtpServer.cc:1161
void handleErrorReply(const HttpReply *header, StoreIOBuffer receivedData)
Definition: FtpServer.cc:934
void handleEpsvReply(const HttpReply *header, StoreIOBuffer receivedData)
Definition: FtpServer.cc:1072
optimized set of C chars, with quick membership test and merge support
Definition: CharacterSet.h:17
int caseCmp(const SBuf &S, const size_type n) const
shorthand version for case-insensitive compare()
Definition: SBuf.h:287
void writeCustomReply(const int code, const char *msg, const HttpReply *reply=nullptr)
Definition: FtpServer.cc:507
void clientPinnedConnectionClosed(const CommCloseCbParams &io) override
Our close handler called by Comm when the pinned connection is closed.
Definition: FtpServer.cc:316
bool handleUploadRequest(String &cmd, String ¶ms)
Definition: FtpServer.cc:1534
void changeState(const Ftp::ServerState newState, const char *reason)
Definition: FtpServer.cc:529
HttpHeaderEntry * getEntry(HttpHeaderPos *pos) const
Definition: HttpHeader.cc:583
virtual void callException(const std::exception &e)
called when the job throws during an async call
Definition: AsyncJob.cc:143
void connectedForData(const CommConnectCbParams ¶ms)
Done establishing a data connection to the user.
Definition: FtpServer.cc:1703
void noteMoreBodySpaceAvailable(BodyPipe::Pointer) override
Definition: FtpServer.cc:222
Definition: Address.h:42
void resetLogin(const char *reason)
clear client and server login-related state after the old login is gone
Definition: FtpServer.cc:336
bool handleEpsvRequest(String &cmd, String ¶ms)
Definition: FtpServer.cc:1596
Definition: HttpHeader.h:74
void handlePortReply(const HttpReply *header, StoreIOBuffer receivedData)
Definition: FtpServer.cc:921
AnyP::ProtocolVersion ProtocolVersion(unsigned int aMajor, unsigned int aMinor)
HTTP version label information.
Definition: ProtocolVersion.h:19
static Pointer MakePortful(const AnyP::PortCfgPointer &aPort)
Definition: MasterXaction.h:54
Definition: Subscription.h:48
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products