128 void start()
override;
192#define CTRL_BUFLEN 16*1024
344 old_filepath(nullptr),
366 debugs(9, 3, entry->url());
370 "control channel " << ctrl.conn);
399 debugs(9, 4,
"login=" << login <<
", escaped=" << escaped);
400 debugs(9, 9,
"IN : login=" << login <<
", escaped=" << escaped <<
", user=" << user <<
", password=" << password);
411 const SBuf userName = login.
substr(0, colonPos);
414 debugs(9, 9,
"found user=" << userName <<
' ' <<
415 (upto != userName.
length() ?
", truncated-to=" :
", length=") << upto <<
416 ", escaped=" << escaped);
419 debugs(9, 9,
"found user=" << user <<
" (" << strlen(user) <<
") unescaped.");
429 debugs(9, 9,
"found password=" << pass <<
" " <<
430 (upto != pass.
length() ?
", truncated-to=" :
", length=") << upto <<
431 ", escaped=" << escaped);
436 debugs(9, 9,
"found password=" << password <<
" (" << strlen(password) <<
") unescaped.");
439 debugs(9, 9,
"OUT: login=" << login <<
", escaped=" << escaped <<
", user=" << user <<
", password=" << password);
446 debugs(9, 5,
"The control connection to the remote end is closed");
456 const char *note = entry->url();
465 debugs(9, 3,
"Unconnected data socket created on " <<
conn);
468 conn->tos = ctrl.conn->tos;
469 conn->nfmark = ctrl.conn->nfmark;
475 data.opened(
conn, dataCloser());
476 switchTimeoutToDataChannel();
482 if (SENT_PASV == state) {
484 flags.pasv_supported =
false;
488 dataConnWait.cancel(
"timeout");
497 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
498 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
506 for (i = 0; i < 12; ++i)
507 if (!strcasecmp(buf,
Month[i]))
530 struct FtpLineToken {
531 char *token =
nullptr;
536 static char tbuf[128];
537 char *xbuf =
nullptr;
538 static int scan_ftp_initialized = 0;
539 static regex_t scan_ftp_integer;
540 static regex_t scan_ftp_time;
541 static regex_t scan_ftp_dostime;
542 static regex_t scan_ftp_dosdate;
544 if (!scan_ftp_initialized) {
545 scan_ftp_initialized = 1;
546 regcomp(&scan_ftp_integer,
"^[0123456789]+$", REG_EXTENDED | REG_NOSUB);
547 regcomp(&scan_ftp_time,
"^[0123456789:]+$", REG_EXTENDED | REG_NOSUB);
548 regcomp(&scan_ftp_dosdate,
"^[0123456789]+-[0123456789]+-[0123456789]+$", REG_EXTENDED | REG_NOSUB);
549 regcomp(&scan_ftp_dostime,
"^[0123456789]+:[0123456789]+[AP]M$", REG_EXTENDED | REG_NOSUB | REG_ICASE);
573 tokens[n_tokens].pos = t - xbuf;
580 for (i = 3; i < n_tokens - 2; ++i) {
589 if (regexec(&scan_ftp_integer,
size, 0,
nullptr, 0) != 0)
592 if (regexec(&scan_ftp_integer, day, 0,
nullptr, 0) != 0)
595 if (regexec(&scan_ftp_time, year, 0,
nullptr, 0) != 0)
598 const auto *copyFrom = buf +
tokens[i].pos;
601 auto dateSize = snprintf(tbuf,
sizeof(tbuf),
"%s %2s %5s", month, day, year);
602 bool isTypeA = (dateSize == 12) && (strncmp(copyFrom, tbuf, dateSize) == 0);
605 dateSize = snprintf(tbuf,
sizeof(tbuf),
"%s %2s %-5s", month, day, year);
606 bool isTypeB = (dateSize == 12 || dateSize == 11) && (strncmp(copyFrom, tbuf, dateSize) == 0);
609 if (isTypeA || isTypeB) {
612 const auto finalDateSize = snprintf(tbuf,
sizeof(tbuf),
"%s %2s %5s", month, day, year);
613 assert(finalDateSize >= 0);
617 copyFrom = buf +
tokens[i + 2].pos + strlen(
tokens[i + 2].token);
619 while (strchr(
w_space, *copyFrom))
630 if (strchr(
w_space, *copyFrom))
636 if (p->
type ==
'l' && (t = strstr(p->
name,
" -> "))) {
649 regexec(&scan_ftp_dosdate,
tokens[0].token, 0,
nullptr, 0) == 0 &&
650 regexec(&scan_ftp_dostime,
tokens[1].token, 0,
nullptr, 0) == 0) {
651 if (!strcasecmp(
tokens[2].token,
"<dir>")) {
658 snprintf(tbuf,
sizeof(tbuf),
"%s %s",
tokens[0].token,
tokens[1].token);
661 if (p->
type ==
'd') {
678 const char *ct = buf + 1;
683 int l = strcspn(ct,
",");
696 p->
size = atoi(ct + 1);
700 tm = (time_t) strtol(ct + 1, &tmp, 0);
707 *(strstr(p->
date,
"\n")) =
'\0';
729 ct = strstr(ct,
",");
748 for (i = 0; i < n_tokens; ++i)
760 debugs(9, 7,
"line={" << line <<
"}");
762 if (strlen(line) > 1024) {
763 html <<
"<tr><td colspan=\"5\">" << line <<
"</td></tr>\n";
768 if (flags.dir_slash && dirpath && typecode !=
'D') {
775 html <<
"<tr class=\"entry\"><td colspan=\"5\">" << line <<
"</td></tr>\n";
778 for (p = line; *p &&
xisspace(*p); ++p);
780 flags.listformat_unknown = 1;
785 if (!strcmp(parts->
name,
".") || !strcmp(parts->
name,
"..")) {
801 switch (parts->
type) {
804 icon.
appendf(
"<img border=\"0\" src=\"%s\" alt=\"%-6s\">",
811 icon.
appendf(
"<img border=\"0\" src=\"%s\" alt=\"%-6s\">",
826 icon.
appendf(
"<img border=\"0\" src=\"%s\" alt=\"%-6s\">",
829 chdir.
appendf(
"<a href=\"%s/;type=d\"><img border=\"0\" src=\"%s\" "
830 "alt=\"[DIR]\"></a>",
838 icon.
appendf(
"<img border=\"0\" src=\"%s\" alt=\"%-6s\">",
846 if (parts->
type !=
'd') {
849 "alt=\"[VIEW]\"></a>",
855 "alt=\"[DOWNLOAD]\"></a>",
861 html <<
"<tr class=\"entry\">"
862 "<td class=\"icon\"><a href=\"" << href <<
"\">" << icon <<
"</a></td>"
863 "<td class=\"filename\"><a href=\"" << href <<
"\">" <<
html_quote(
text.
c_str()) <<
"</a></td>"
864 "<td class=\"date\">" << parts->
date <<
"</td>"
865 "<td class=\"size\">" <<
size <<
"</td>"
866 "<td class=\"actions\">" << chdir << view << download << link <<
"</td>"
876 char *buf = data.readBuf->content();
883 size_t len = data.readBuf->contentSize();
886 debugs(9, 3,
"no content to parse for " << entry->url() );
893 sbuf = (
char *)
xmalloc(len + 1);
895 end = sbuf + len - 1;
897 while (*end !=
'\r' && *end !=
'\n' && end > sbuf)
902 debugs(9, 3,
"usable = " << usable <<
" of " << len <<
" bytes.");
905 if (buf[0] ==
'\0' && len == 1) {
906 debugs(9, 3,
"NIL ends data from " << entry->url() <<
" transfer problem?");
907 data.readBuf->consume(len);
909 debugs(9, 3,
"didn't find end for " << entry->url());
916 debugs(9, 3, (
unsigned long int)len <<
" bytes to play with");
921 s += strspn(s,
crlf);
923 for (; s < end; s += strcspn(s,
crlf), s += strspn(s,
crlf)) {
924 debugs(9, 7,
"s = {" << s <<
"}");
925 linelen = strcspn(s,
crlf) + 1;
935 debugs(9, 7,
"{" << line <<
"}");
937 if (!strncmp(line,
"total", 5))
944 if (htmlifyListEntry(line, html)) {
952 data.readBuf->consume(usable);
968 if (!flags.http_header_sent && data.readBuf->contentSize() >= 0 && !flags.isdir)
969 appendSuccessHeader();
976 abortAll(
"entry aborted after calling appendSuccessHeader()");
982 if (adaptationAccessCheckPending) {
983 debugs(9, 3,
"returning from Ftp::Gateway::processReplyBody due to adaptationAccessCheckPending");
990 if (!flags.listing) {
995 maybeReadVirginBody();
997 }
else if (
const int csize = data.readBuf->contentSize()) {
998 writeReplyBody(data.readBuf->content(), csize);
999 debugs(9, 5,
"consuming " << csize <<
" bytes of readBuf");
1000 data.readBuf->consume(csize);
1005 maybeReadVirginBody();
1030#if HAVE_AUTH_MODULE_BASIC
1033 if (!auth.isEmpty()) {
1034 flags.authenticated = 1;
1035 loginParser(auth,
false);
1043 loginParser(request->url.userInfo(),
true);
1047 fatal(
"FTP login parsing destroyed username info");
1056 if (strcmp(user,
"anonymous") == 0 && !flags.tried_auth_anonymous) {
1058 flags.tried_auth_anonymous=1;
1060 }
else if (!flags.tried_auth_nopass) {
1062 flags.tried_auth_nopass=1;
1076 static const SBuf middle(
";type=");
1077 const auto typeSpecStart = request->url.path().find(middle);
1079 const auto fullPath = request->url.path();
1080 const auto typecodePos = typeSpecStart + middle.
length();
1081 typecode = (typecodePos < fullPath.length()) ?
1082 static_cast<char>(
xtoupper(fullPath[typecodePos])) :
'\0';
1083 request->url.path(fullPath.substr(0, typeSpecStart));
1086 int l = request->url.path().length();
1092 flags.need_base_href = 1;
1093 }
else if (!request->url.path().cmp(
"/%2f/")) {
1097 }
else if ((l >= 1) && (request->url.path()[l-1] ==
'/')) {
1104 flags.dir_slash = 1;
1111 title_url =
"ftp://";
1113 if (strcmp(user,
"anonymous")) {
1114 title_url.append(user);
1115 title_url.append(
"@");
1121 title_url.
append(request->url.path().rawContent(), request->url.path().length());
1123 base_href =
"ftp://";
1125 if (strcmp(user,
"anonymous") != 0) {
1137 base_href.
append(request->url.path().rawContent(), request->url.path().length());
1144 if (!checkAuth(&request->header)) {
1146 SBuf realm(ftpRealm());
1147 const auto reply = ftpAuthRequired(request.getRaw(), realm, fwd->al);
1148 entry->replaceHttpReply(reply);
1155 debugs(9, 5,
"FD " << (ctrl.conn ? ctrl.conn->fd : -1) <<
" : host=" << request->url.host() <<
1156 ", path=" << request->url.path() <<
", user=" << user <<
", passwd=" << password);
1167 if (ctrl.message ==
nullptr)
1174 cwd_message.append(
'\n');
1175 cwd_message.append(w->key);
1199 }
else if (
code == 120) {
1219 if ((state == SENT_USER || state == SENT_PASS) && ctrl.replycode >= 400) {
1220 if (ctrl.replycode == 421 || ctrl.replycode == 426) {
1223 }
else if (ctrl.replycode >= 430 && ctrl.replycode <= 439) {
1226 }
else if (ctrl.replycode >= 530 && ctrl.replycode <= 539) {
1240 failed(
ERR_NONE, ctrl.replycode, err);
1246#if HAVE_AUTH_MODULE_BASIC
1249 SBuf realm(ftpRealm());
1254 entry->replaceHttpReply(newrep);
1264 realm.
appendf(
"FTP %s ", user);
1266 realm.
append(
"unknown", 7);
1268 realm.
append(request->url.host());
1269 const auto &rport = request->url.port();
1270 if (rport && *rport != 21)
1271 realm.
appendf(
" port %hu", *rport);
1301 }
else if (
code == 331) {
1398 p += strcspn(p,
"/");
1434 debugs(9, 3,
"the final component was a directory");
1446 debugs(9, 3,
"final component is probably a file");
1455 char *path =
nullptr;
1465 if (!strcmp(path,
"..") || !strcmp(path,
"/")) {
1511 char *path =
nullptr;
1518 debugs(9, 3,
"with path=" << path);
1530 debugs(9, 3,
"path " << path <<
", code " <<
code);
1534 }
else if (
code == 550) {
1557 debugs(9, 3,
"Directory path did not end in /");
1587 }
else if (
code < 0) {
1627 debugs(9, 2,
"SIZE reported " <<
1632 }
else if (
code < 0) {
1682 debugs(9, 5,
"handling HEAD response");
1684 appendSuccessHeader();
1692 abortAll(
"entry aborted while processing HEAD");
1697 if (adaptationAccessCheckPending) {
1698 debugs(9,3,
"returning due to adaptationAccessCheckPending");
1725 dataConnWait.finish();
1728 debugs(9, 2,
"Failed to connect. Retrying via another method.");
1732 writeCommand(
"ABOR\r\n");
1739 data.opened(io.
conn, dataCloser());
1747 if (ftpState->
data.
conn !=
nullptr) {
1757 debugs(9, 5,
"The control connection to the remote end is closed");
1775 if (setsockopt(ftpState->
ctrl.
conn->
fd, SOL_SOCKET, SO_REUSEADDR,
1776 (
char *) &on,
sizeof(on)) == -1) {
1799 debugs(9,
DBG_IMPORTANT,
"FTP does not allow PORT method after 'EPSV ALL' has been sent.");
1824 struct addrinfo *AI =
nullptr;
1826 unsigned char *addrptr = (
unsigned char *) &((
struct sockaddr_in*)AI->ai_addr)->sin_addr;
1827 unsigned char *portptr = (
unsigned char *) &((
struct sockaddr_in*)AI->ai_addr)->sin_port;
1829 addrptr[0], addrptr[1], addrptr[2], addrptr[3],
1830 portptr[0], portptr[1]);
1845 debugs(9, 3,
"PORT not supported by remote end");
1860 debugs(9, 3,
"EPRT not supported by remote end");
1878 debugs(9, 5,
"The control connection to the remote end is closed");
1883 data.listenConn->close();
1884 data.listenConn =
nullptr;
1892 abortAll(
"entry aborted when accepting data conn");
1893 data.listenConn->close();
1894 data.listenConn =
nullptr;
1901 data.listenConn =
nullptr;
1921 "ERROR: FTP data connection from unexpected server (" <<
1923 data.conn->remote <<
" or " << ctrl.conn->remote);
1935 data.opened(io.
conn, dataCloser());
1938 debugs(9, 3,
"Connected data socket on " <<
1939 io.
conn <<
". FD table says: " <<
1940 "ctrl-peer= " <<
fd_table[ctrl.conn->fd].ipaddr <<
", " <<
1941 "data-peer= " <<
fd_table[data.conn->fd].ipaddr);
1943 assert(haveControlChannel(
"ftpAcceptDataConnection"));
1944 assert(ctrl.message ==
nullptr);
1981 if (ftpState->
filepath !=
nullptr) {
2006 int code = ctrl.replycode;
2010 if (!originalRequest()->body_pipe) {
2011 debugs(9, 3,
"zero-size STOR?");
2012 state = WRITING_DATA;
2017 if (!startRequestBodyFlow()) {
2023 debugs(9, 3,
"starting data transfer");
2024 switchTimeoutToDataChannel();
2025 sendMoreRequestBody();
2026 fwd->dontRetry(
true);
2027 state = WRITING_DATA;
2028 debugs(9, 3,
"writing data channel");
2029 }
else if (
code == 150) {
2031 debugs(9, 3,
"ftpReadStor: accepting data channel");
2032 listenForDataChannel(data.conn);
2056 if (restart_offset > 0)
2059 if (!request->range)
2068 int64_t desired_offset = request->range->lowestOffset(theSize);
2070 if (desired_offset <= 0)
2073 if (desired_offset >= theSize)
2076 restart_offset = desired_offset;
2090 }
else if (
code > 0) {
2091 debugs(9, 3,
"REST not supported");
2152 }
else if (
code == 150) {
2192 }
else if (
code == 150) {
2195 }
else if (
code >= 300) {
2215 entry->lock(
"Ftp::Gateway");
2220 ctrl.message =
nullptr;
2223 entry->unlock(
"Ftp::Gateway");
2253 debugs(9, 3,
"ftpState=" <<
this);
2263 if (!(
code == 226 ||
code == 250)) {
2327 if (old_request !=
nullptr) {
2337 setCurrentOffset(0);
2343 if (old_request ==
nullptr) {
2344 old_request = ctrl.last_command;
2345 ctrl.last_command =
nullptr;
2346 old_reply = ctrl.last_reply;
2347 ctrl.last_reply =
nullptr;
2349 if (pathcomps ==
nullptr && filepath !=
nullptr)
2350 old_filepath =
xstrdup(filepath);
2360 const bool slashHack = ftpState->
request->
url.
path().caseCmp(
"/%2f", 4)==0;
2365 " reply code " <<
code <<
"flags(" <<
2368 "mdtm=" << ftpState->
mdtm <<
", size=" << ftpState->
theSize <<
2369 "slashhack=" << (slashHack?
"T":
"F"));
2376 switch (ftpState->
state) {
2392 ftpState->
failed(error_code, 0, ftperr);
2394 HttpReply *newrep = ftperr->BuildHttpReply();
2411 if (ctrl.replycode > 500) {
2414 }
else if (ctrl.replycode == 421) {
2423 if (ctrl.replycode == 550) {
2446 debugs(9, 5,
"ftpState (" << ftpState <<
") is valid!");
2451 }
else if (
code == 227) {
2485 if (flags.http_header_sent)
2490 flags.http_header_sent = 1;
2492 assert(entry->isEmpty());
2496 SBuf urlPath = request->url.path();
2497 auto t = urlPath.
rfind(
'/');
2500 const char *mime_type =
nullptr;
2501 const char *mime_enc =
nullptr;
2504 mime_type =
"text/html";
2509 mime_type =
"application/octet-stream";
2515 mime_type =
"text/plain";
2528 if (0 == getCurrentOffset()) {
2531 }
else if (theSize < getCurrentOffset()) {
2539 " current offset=" << getCurrentOffset() <<
2540 ", but theSize=" << theSize <<
2541 ". assuming full content response");
2546 range_spec.
offset = getCurrentOffset();
2547 range_spec.
length = theSize - getCurrentOffset();
2557 setVirginReply(reply);
2558 adaptOrFinalizeReply();
2571 if (flags.authenticated ||
2572 getCurrentOffset() ||
2583#if HAVE_AUTH_MODULE_BASIC
2603 if (request->
url.
path()[0] ==
'/') {
2606 }
else if (!request->
url.
path().startsWith(newbuf)) {
2621 debugs(9, 5,
"writing " << dataLength <<
" bytes to the reply");
2622 addVirginReplyBody(dataToWrite, dataLength);
2634 if (fwd ==
nullptr || flags.completed_forwarding) {
2635 debugs(9, 3,
"avoid double-complete on FD " <<
2636 (ctrl.conn ? ctrl.conn->fd : -1) <<
", Data FD " << data.conn->fd <<
2637 ", this " <<
this <<
", fwd " << fwd);
2641 flags.completed_forwarding =
true;
2654 if (doneWithServer())
2659 debugs(9,
DBG_IMPORTANT,
"WARNING: FTP Server Control channel is closed, but Data channel still active.");
2660 debugs(9, 2, caller_name <<
": attempted on a closed FTP channel.");
2671 return !doneWithServer();
#define JobCallback(dbgSection, dbgLevel, Dialer, job, method)
Convenience macro to create a Dialer-based job callback.
static FTPSM ftpReadTransferDone
static FTPSM ftpReadMkdir
static void ftpListPartsFree(ftpListParts **parts)
static FTPSM ftpWriteTransferDone
static void ftpOpenListenSocket(Ftp::Gateway *ftpState, int fallback)
static char cbuf[CTRL_BUFLEN]
static const char * Month[]
static void ftpTrySlashHack(Ftp::Gateway *ftpState)
CBDATA_NAMESPACED_CLASS_INIT(Ftp, Gateway)
static FTPSM ftpReadWelcome
static FTPSM ftpSendReply
static FTPSM ftpRestOrList
static int is_month(const char *buf)
static FTPSM ftpTraverseDirectory
static FTPSM ftpSendPassive
static FTPSM ftpSendMkdir
static ftpListParts * ftpListParseParts(const char *buf, struct Ftp::GatewayFlags flags)
void httpHeaderAddContRange(HttpHeader *, HttpHdrRangeSpec, int64_t)
void SBufToCstring(char *d, const SBuf &s)
#define SQUIDSBUFPRINT(s)
int conn
the current server connection FD
void error(char *format,...)
int cbdataReferenceValid(const void *p)
AnyP::UriScheme const & getScheme() const
void host(const char *src)
static void Start(const Pointer &job)
virtual void completeForwarding()
virtual void handleRequestBodyProducerAborted()=0
HttpRequestPointer request
void markParsedVirginReplyAsWhole(const char *reasonWeAreSure)
virtual void haveParsedReplyHeaders()
called when we have final (possibly adapted) reply headers; kids extend
int xerrno
The last errno to occur. non-zero if flag is Comm::COMM_ERROR.
Comm::Flag flag
comm layer result status.
Comm::ConnectionPointer conn
void detailError(const ErrorDetail::Pointer &dCode)
set error type-specific detail code
HttpRequestPointer request
HttpReply * BuildHttpReply(void)
struct ErrorState::@56 ftp
Comm::ConnectionPointer listenConn
void close()
planned close: removes the close handler and calls comm_close
void clear()
remove the close handler, leave connection open
Comm::ConnectionPointer conn
channel descriptor
FTP client functionality shared among FTP Gateway and Relay clients.
virtual Http::StatusCode failedHttpStatus(err_type &error)
void start() override
called by AsyncStart; do not call directly
bool handleEpsvReply(Ip::Address &remoteAddr)
virtual void handleControlReply()
void writeCommand(const char *buf)
virtual void timeout(const CommTimeoutCbParams &io)
read timeout handler
bool handlePasvReply(Ip::Address &remoteAddr)
void switchTimeoutToDataChannel()
void connectDataChannel()
DataChannel data
FTP data channel state.
void maybeReadVirginBody() override
read response data from the network
virtual void failed(err_type error=ERR_NONE, int xerrno=0, ErrorState *ftperr=nullptr)
handle a fatal transaction error, closing the control connection
CtrlChannel ctrl
FTP control channel state.
virtual void dataClosed(const CommCloseCbParams &io)
handler called by Comm when FTP data channel is closed unexpectedly
int checkAuth(const HttpHeader *req_hdr)
Http::StatusCode failedHttpStatus(err_type &error) override
bool htmlifyListEntry(const char *line, PackableStream &)
void handleControlReply() override
void writeReplyBody(const char *, size_t len)
void processHeadResponse()
void listenForDataChannel(const Comm::ConnectionPointer &conn)
create a data channel acceptor and start listening.
void dataClosed(const CommCloseCbParams &io) override
handler called by Comm when FTP data channel is closed unexpectedly
bool mayReadVirginReplyBody() const override
whether we may receive more virgin response body bytes
void hackShortcut(StateMethod *nextState)
void setCurrentOffset(int64_t offset)
void handleRequestBodyProducerAborted() override
void start() override
called by AsyncStart; do not call directly
virtual bool haveControlChannel(const char *caller_name) const
void haveParsedReplyHeaders() override
called when we have final (possibly adapted) reply headers; kids extend
void dataChannelConnected(const CommConnectCbParams &io) override
void completeForwarding() override
static HttpReply * ftpAuthRequired(HttpRequest *request, SBuf &realm, AccessLogEntry::Pointer &)
void timeout(const CommTimeoutCbParams &io) override
read timeout handler
void loginParser(const SBuf &login, bool escaped)
void appendSuccessHeader()
MemBuf listing
FTP directory listing in HTML format.
void processReplyBody() override
void completedListing(void)
int64_t getCurrentOffset() const
void ftpAcceptDataConnection(const CommAcceptCbParams &io)
AccessLogEntryPointer al
info for the future access.log entry
void setHeaders(Http::StatusCode status, const char *reason, const char *ctype, int64_t clen, time_t lmt, time_t expires)
AnyP::Uri url
the request URI
const SBuf & effectiveRequestUri() const
RFC 7230 section 5.5 - Effective Request URI.
@ srcFtp
ftp_port or FTP server
uint32_t sources
The message sources.
static void FreeAddr(struct addrinfo *&ai)
void getAddrInfo(struct addrinfo *&ai, int force=AF_UNSPEC) const
unsigned short port() const
void init(mb_size_t szInit, mb_size_t szMax)
char * content()
start of the added data
mb_size_t contentSize() const
available data size
const char * rawContent() const
static const size_type npos
size_type length() const
Returns the number of bytes stored in SBuf.
SBuf & appendf(const char *fmt,...) PRINTF_FORMAT_ARG2
size_type rfind(char c, size_type endPos=npos) const
size_type find(char c, size_type startPos=0) const
size_type copy(char *dest, size_type n) const
SBuf & append(const SBuf &S)
SBuf substr(size_type pos, size_type n=npos) const
MemBlob::size_type size_type
struct SquidConfig::@108 Ftp
void release(const bool shareable=false)
bool makePublic(const KeyScope keyScope=ksDefault)
void replaceHttpReply(const HttpReplyPointer &, const bool andStartWriting=true)
void append(char const *buf, int len)
void reset(char const *str)
void comm_open_listener(int sock_type, int proto, Comm::ConnectionPointer &conn, const char *note)
#define debugs(SECTION, LEVEL, CONTENT)
#define EBIT_TEST(flag, bit)
@ ERR_CACHE_ACCESS_DENIED
void fatal(const char *message)
char * html_quote(const char *string)
void memFree(void *, int type)
Free a element allocated by memAllocate()
void * memAllocate(mem_type)
Allocate one element from the typed pool.
const char * mimeGetIconURL(const char *fn)
const char * mimeGetContentEncoding(const char *fn)
char mimeGetTransferMode(const char *fn)
bool mimeGetViewOption(const char *fn)
const char * mimeGetContentType(const char *fn)
bool mimeGetDownloadOption(const char *fn)
bool IsConnOpen(const Comm::ConnectionPointer &conn)
const SBuf & UrlWith2f(HttpRequest *)
void StartGateway(FwdState *const fwdState)
A new FTP Gateway job.
void() StateMethod(Ftp::Gateway *)
void Controller::create() STUB void Controller Controller nil
time_t ParseIso3307(const char *)
Convert from ISO 3307 style time: YYYYMMDDHHMMSS or YYYYMMDDHHMMSS.xxx.
char * rfc1738_do_escape(const char *url, int flags)
#define rfc1738_escape_part(x)
#define rfc1738_escape(x)
void rfc1738_unescape(char *url)
int64_t strtoll(const char *nptr, char **endptr, int base)
bool completed_forwarding
bool pasv_supported
PASV command is allowed.
bool tried_auth_anonymous
auth has tried to use anonymous credentials already.
bool epsv_all_sent
EPSV ALL has been used. Must abort on failures.
bool authenticated
authentication success
bool tried_auth_nopass
auth tried username with no password already.
SBuf text("GET http://resource.com/path HTTP/1.1\r\n" "Host: resource.com\r\n" "Cookie: laijkpk3422r j1noin \r\n" "\r\n")
const char * wordlistAdd(wordlist **list, const char *key)
void wordlistDestroy(wordlist **list)
destroy a wordlist
char * wordlistChopHead(wordlist **wl)
void * xcalloc(size_t n, size_t sz)
const char * xstrerr(int error)
char * xstrncpy(char *dst, const char *src, size_t n)
char * xstrndup(const char *s, size_t n)