namespace FluentFTP.Proxy {
///
/// A FTP client with a user@host proxy identification, that works with Blue Coat FTP Service servers.
///
/// The 'blue coat variant' forces the client to wait for a 220 FTP response code in
/// the handshake phase.
///
public class FtpClientUserAtHostProxyBlueCoat : FtpClientProxy
{
/// A FTP client with a user@host proxy identification.
/// Proxy information
public FtpClientUserAtHostProxyBlueCoat(ProxyInfo proxy)
: base(proxy)
{
ConnectionType = "User@Host";
}
///
/// Creates a new instance of this class. Useful in FTP proxy classes.
///
protected override FtpClient Create()
{
return new FtpClientUserAtHostProxyBlueCoat(Proxy);
}
/// Redefine the first dialog: auth with proxy information
protected override void Handshake()
{
// Proxy authentication eventually needed.
if (Proxy.Credentials != null)
Authenticate(Proxy.Credentials.UserName, Proxy.Credentials.Password);
// Connection USER@Host means to change user name to add host.
Credentials.UserName = Credentials.UserName + "@" + Host;
FtpReply reply = GetReply();
if (reply.Code == "220")
FtpTrace.WriteLine(FtpTraceLevel.Info, "Status: Server is ready for the new client");
}
}
}