NULL, // fssHandleCdup
&Ftp::Server::handleErrorReply // fssError
};
- const Server &server = dynamic_cast<const Ftp::Server&>(*context->getConn());
- if (const ReplyHandler handler = handlers[server.master->serverState])
- (this->*handler)(reply, data);
- else
- writeForwardedReply(reply);
+ try {
+ const Server &server = dynamic_cast<const Ftp::Server&>(*context->getConn());
+ if (const ReplyHandler handler = handlers[server.master->serverState])
+ (this->*handler)(reply, data);
+ else
+ writeForwardedReply(reply);
+ } catch (const std::exception &e) {
+ callException(e);
+ throw TexcHere(e.what());
+ }
}
void
return;
}
+ Must(reply);
HttpReply::Pointer featReply = Ftp::HttpReplyWrapper(211, "End", Http::scNoContent, 0);
HttpHeader const &serverReplyHeader = reply->header;
void
Ftp::Server::writeForwardedReply(const HttpReply *reply)
{
- assert(reply != NULL);
+ Must(reply);
+
const HttpHeader &header = reply->header;
// adaptation and forwarding errors lack Http::HdrType::FTP_STATUS
if (!header.has(Http::HdrType::FTP_STATUS)) {
}
#endif
- assert(reply != NULL);
+ Must(reply);
const char *reason = reply->header.has(Http::HdrType::FTP_REASON) ?
reply->header.getStr(Http::HdrType::FTP_REASON):
reply->sline.reason();
http->storeEntry()->replaceHttpReply(reply);
}
+void
+Ftp::Server::callException(const std::exception &e)
+{
+ debugs(33, 2, "FTP::Server job caught: " << e.what());
+ closeDataConnection();
+ unpinConnection(true);
+ if (Comm::IsConnOpen(clientConnection))
+ clientConnection->close();
+ AsyncJob::callException(e);
+}
+
/// Whether Squid FTP Relay supports a named feature (e.g., a command).
static bool
Ftp::SupportedCommand(const SBuf &name)