mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-10 16:28:13 +01:00
Merge branch 'poco-1.10.0' into devel
This commit is contained in:
commit
26f08dc45b
@ -117,9 +117,9 @@ namespace
|
||||
if (_iv.size() != EVP_CIPHER_iv_length(_pCipher) && EVP_CIPHER_mode(_pCipher) == EVP_CIPH_GCM_MODE)
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
int rc = EVP_CIPHER_CTX_ctrl(_pContext, EVP_CTRL_GCM_SET_IVLEN, _iv.size(), NULL);
|
||||
int rc = EVP_CIPHER_CTX_ctrl(_pContext, EVP_CTRL_GCM_SET_IVLEN, static_cast<int>(_iv.size()), NULL);
|
||||
#else
|
||||
int rc = EVP_CIPHER_CTX_ctrl(&_context, EVP_CTRL_GCM_SET_IVLEN, _iv.size(), NULL);
|
||||
int rc = EVP_CIPHER_CTX_ctrl(&_context, EVP_CTRL_GCM_SET_IVLEN, static_cast<int>(_iv.size()), NULL);
|
||||
#endif
|
||||
if (rc == 0) throwError();
|
||||
}
|
||||
@ -164,9 +164,9 @@ namespace
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10001000L
|
||||
Poco::Buffer<char> buffer(tagSize);
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
int rc = EVP_CIPHER_CTX_ctrl(_pContext, EVP_CTRL_GCM_GET_TAG, tagSize, buffer.begin());
|
||||
int rc = EVP_CIPHER_CTX_ctrl(_pContext, EVP_CTRL_GCM_GET_TAG, static_cast<int>(tagSize), buffer.begin());
|
||||
#else
|
||||
int rc = EVP_CIPHER_CTX_ctrl(&_context, EVP_CTRL_GCM_GET_TAG, tagSize, buffer.begin());
|
||||
int rc = EVP_CIPHER_CTX_ctrl(&_context, EVP_CTRL_GCM_GET_TAG, static_cast<int>(tagSize), buffer.begin());
|
||||
#endif
|
||||
if (rc == 0) throwError();
|
||||
tag.assign(buffer.begin(), tagSize);
|
||||
@ -178,9 +178,9 @@ namespace
|
||||
void CryptoTransformImpl::setTag(const std::string& tag)
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
int rc = EVP_CIPHER_CTX_ctrl(_pContext, EVP_CTRL_GCM_SET_TAG, tag.size(), const_cast<char*>(tag.data()));
|
||||
int rc = EVP_CIPHER_CTX_ctrl(_pContext, EVP_CTRL_GCM_SET_TAG, static_cast<int>(tag.size()), const_cast<char*>(tag.data()));
|
||||
#elif OPENSSL_VERSION_NUMBER >= 0x10001000L
|
||||
int rc = EVP_CIPHER_CTX_ctrl(&_context, EVP_CTRL_GCM_SET_TAG, tag.size(), const_cast<char*>(tag.data()));
|
||||
int rc = EVP_CIPHER_CTX_ctrl(&_context, EVP_CTRL_GCM_SET_TAG, static_cast<int>(tag.size()), const_cast<char*>(tag.data()));
|
||||
#else
|
||||
int rc = 0;
|
||||
#endif
|
||||
|
@ -51,40 +51,37 @@ public:
|
||||
{
|
||||
FTP_PORT = 21
|
||||
};
|
||||
|
||||
|
||||
enum FileType
|
||||
{
|
||||
TYPE_TEXT, // TYPE A (ASCII)
|
||||
TYPE_BINARY // TYPE I (Image)
|
||||
TYPE_TEXT, /// TYPE A (ASCII)
|
||||
TYPE_BINARY /// TYPE I (Image/binary data)
|
||||
};
|
||||
|
||||
|
||||
FTPClientSession();
|
||||
/// Creates an FTPClientSession.
|
||||
///
|
||||
/// Passive mode will be used for data transfers.
|
||||
|
||||
explicit FTPClientSession(const StreamSocket& socket);
|
||||
FTPClientSession(const StreamSocket& socket, bool readWelcomeMessage = true);
|
||||
/// Creates an FTPClientSession using the given
|
||||
/// connected socket for the control connection.
|
||||
///
|
||||
/// Passive mode will be used for data transfers.
|
||||
|
||||
FTPClientSession(const std::string& host,
|
||||
Poco::UInt16 port = FTP_PORT,
|
||||
const std::string& username = "",
|
||||
const std::string& password = "");
|
||||
|
||||
FTPClientSession(const std::string& host, Poco::UInt16 port = FTP_PORT, const std::string& username = "", const std::string& password = "");
|
||||
/// Creates an FTPClientSession using a socket connected
|
||||
/// to the given host and port. If username is supplied,
|
||||
/// login is attempted.
|
||||
///
|
||||
/// Passive mode will be used for data transfers.
|
||||
|
||||
|
||||
virtual ~FTPClientSession();
|
||||
/// Destroys the FTPClientSession.
|
||||
|
||||
|
||||
void setTimeout(const Poco::Timespan& timeout);
|
||||
/// Sets the timeout for socket operations.
|
||||
|
||||
|
||||
Poco::Timespan getTimeout() const;
|
||||
/// Returns the timeout for socket operations.
|
||||
|
||||
@ -95,18 +92,15 @@ public:
|
||||
/// EPSV command is used (with a fallback to PASV if EPSV fails)
|
||||
/// for switching to passive mode. The same applies to
|
||||
/// EPRT and PORT for active connections.
|
||||
|
||||
|
||||
bool getPassive() const;
|
||||
/// Returns true iff passive mode is enabled for this connection.
|
||||
|
||||
void open(const std::string& host,
|
||||
Poco::UInt16 port,
|
||||
const std::string& username = "",
|
||||
const std::string& password = "");
|
||||
|
||||
virtual void open(const std::string& host, Poco::UInt16 port, const std::string& username = "", const std::string& password = "");
|
||||
/// Opens the FTP connection to the given host and port.
|
||||
/// If username is supplied, login is attempted.
|
||||
|
||||
void login(const std::string& username, const std::string& password);
|
||||
virtual void login(const std::string& username, const std::string& password);
|
||||
/// Authenticates the user against the FTP server. Must be
|
||||
/// called before any other commands (except QUIT) can be sent.
|
||||
///
|
||||
@ -117,18 +111,21 @@ public:
|
||||
/// NetException in case of a general network communication failure.
|
||||
|
||||
void logout();
|
||||
/// Logs out from the server by sending a QUIT command. Any transfer
|
||||
/// that's in progress is ended. The control connection is kept
|
||||
/// open.
|
||||
|
||||
void close();
|
||||
/// Sends a QUIT command and closes the connection to the server.
|
||||
///
|
||||
/// Throws a FTPException in case of a FTP-specific error, or a
|
||||
/// NetException in case of a general network communication failure.
|
||||
|
||||
|
||||
std::string systemType();
|
||||
/// Returns the system type of the FTP server.
|
||||
///
|
||||
/// Sends a SYST command to the server and returns the result.
|
||||
|
||||
|
||||
void setFileType(FileType type);
|
||||
/// Sets the file type for transferring files.
|
||||
///
|
||||
@ -144,7 +141,7 @@ public:
|
||||
void setWorkingDirectory(const std::string& path);
|
||||
/// Changes the current working directory on the server.
|
||||
///
|
||||
/// Sends a CWD command with the given path as argument to the
|
||||
/// Sends a CWD command with the given path as argument to the
|
||||
/// server.
|
||||
///
|
||||
/// Throws a FTPException in case of a FTP-specific error, or a
|
||||
@ -155,7 +152,7 @@ public:
|
||||
///
|
||||
/// Throws a FTPException in case of a FTP-specific error, or a
|
||||
/// NetException in case of a general network communication failure.
|
||||
|
||||
|
||||
void cdup();
|
||||
/// Moves one directory up from the current working directory
|
||||
/// on the server.
|
||||
@ -164,7 +161,7 @@ public:
|
||||
///
|
||||
/// Throws a FTPException in case of a FTP-specific error, or a
|
||||
/// NetException in case of a general network communication failure.
|
||||
|
||||
|
||||
void rename(const std::string& oldName, const std::string& newName);
|
||||
/// Renames the file on the server given by oldName to newName.
|
||||
///
|
||||
@ -172,7 +169,7 @@ public:
|
||||
///
|
||||
/// Throws a FTPException in case of a FTP-specific error, or a
|
||||
/// NetException in case of a general network communication failure.
|
||||
|
||||
|
||||
void remove(const std::string& path);
|
||||
/// Deletes the file specified by path on the server.
|
||||
///
|
||||
@ -217,11 +214,11 @@ public:
|
||||
/// the native text file format.
|
||||
/// The InputLineEndingConverter class from the Foundation
|
||||
/// library can be used for that purpose.
|
||||
|
||||
|
||||
void endDownload();
|
||||
/// Must be called to complete a download initiated with
|
||||
/// beginDownload().
|
||||
|
||||
|
||||
std::ostream& beginUpload(const std::string& path);
|
||||
/// Starts uploading the file with the given name.
|
||||
/// After all data has been written to the returned stream,
|
||||
@ -274,9 +271,9 @@ public:
|
||||
/// client waits for a connection request from the server.
|
||||
/// After establishing the data connection, a SocketStream
|
||||
/// for transferring the data is created.
|
||||
|
||||
|
||||
void endList();
|
||||
/// Must be called to complete a directory listing download
|
||||
/// Must be called to complete a directory listing download
|
||||
/// initiated with beginList().
|
||||
|
||||
void abort();
|
||||
@ -287,7 +284,7 @@ public:
|
||||
///
|
||||
/// A separate call to endDownload() or endUpload() is
|
||||
/// not necessary.
|
||||
|
||||
|
||||
int sendCommand(const std::string& command, std::string& response);
|
||||
/// Sends the given command verbatim to the server
|
||||
/// and waits for a response.
|
||||
@ -302,7 +299,15 @@ public:
|
||||
bool isLoggedIn() const;
|
||||
/// Returns true if the session is logged in.
|
||||
|
||||
bool isSecure() const;
|
||||
/// Returns true if the session is FTPS.
|
||||
|
||||
const std::string& welcomeMessage();
|
||||
/// Returns the welcome message.
|
||||
|
||||
protected:
|
||||
virtual void receiveServerReadyReply();
|
||||
|
||||
enum StatusClass
|
||||
{
|
||||
FTP_POSITIVE_PRELIMINARY = 1,
|
||||
@ -311,9 +316,10 @@ protected:
|
||||
FTP_TRANSIENT_NEGATIVE = 4,
|
||||
FTP_PERMANENT_NEGATIVE = 5
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
DEFAULT_TIMEOUT = 30000000 // 30 seconds default timeout for socket operations
|
||||
DEFAULT_TIMEOUT = 30000000 // 30 seconds default timeout for socket operations
|
||||
};
|
||||
|
||||
static bool isPositivePreliminary(int status);
|
||||
@ -322,7 +328,7 @@ protected:
|
||||
static bool isTransientNegative(int status);
|
||||
static bool isPermanentNegative(int status);
|
||||
std::string extractPath(const std::string& response);
|
||||
StreamSocket establishDataConnection(const std::string& command, const std::string& arg);
|
||||
virtual StreamSocket establishDataConnection(const std::string& command, const std::string& arg);
|
||||
StreamSocket activeDataConnection(const std::string& command, const std::string& arg);
|
||||
StreamSocket passiveDataConnection(const std::string& command, const std::string& arg);
|
||||
void sendPortCommand(const SocketAddress& addr);
|
||||
@ -334,21 +340,24 @@ protected:
|
||||
void parseAddress(const std::string& str, SocketAddress& addr);
|
||||
void parseExtAddress(const std::string& str, SocketAddress& addr);
|
||||
void endTransfer();
|
||||
|
||||
|
||||
DialogSocket* _pControlSocket = nullptr;
|
||||
SocketStream* _pDataStream = nullptr;
|
||||
|
||||
private:
|
||||
FTPClientSession(const FTPClientSession&);
|
||||
FTPClientSession& operator = (const FTPClientSession&);
|
||||
|
||||
std::string _host;
|
||||
Poco::UInt16 _port;
|
||||
DialogSocket* _pControlSocket;
|
||||
SocketStream* _pDataStream;
|
||||
bool _passiveMode;
|
||||
FileType _fileType;
|
||||
bool _supports1738;
|
||||
bool _serverReady;
|
||||
bool _isLoggedIn;
|
||||
Poco::Timespan _timeout;
|
||||
|
||||
std::string _host;
|
||||
Poco::UInt16 _port = FTP_PORT;
|
||||
bool _passiveMode = true;
|
||||
FileType _fileType = TYPE_BINARY;
|
||||
bool _supports1738 = true;
|
||||
bool _serverReady = false;
|
||||
bool _isLoggedIn = false;
|
||||
Poco::Timespan _timeout = DEFAULT_TIMEOUT;
|
||||
std::string _welcomeMessage;
|
||||
Poco::FastMutex _wmMutex;
|
||||
};
|
||||
|
||||
|
||||
@ -397,6 +406,19 @@ inline bool FTPClientSession::isLoggedIn() const
|
||||
}
|
||||
|
||||
|
||||
inline bool FTPClientSession::isSecure() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
inline const std::string& FTPClientSession::welcomeMessage()
|
||||
{
|
||||
Poco::FastMutex::ScopedLock lock(_wmMutex);
|
||||
return _welcomeMessage;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
||||
|
||||
|
@ -30,8 +30,8 @@ namespace Net {
|
||||
class Net_API FTPPasswordProvider
|
||||
/// The base class for all password providers.
|
||||
/// An instance of a subclass of this class can be
|
||||
/// registered with the FTPStreamFactory to
|
||||
/// provide a password
|
||||
/// registered with the FTPStreamFactory to
|
||||
/// provide a password.
|
||||
{
|
||||
public:
|
||||
virtual std::string password(const std::string& username, const std::string& host) = 0;
|
||||
@ -56,7 +56,7 @@ class Net_API FTPStreamFactory: public Poco::URIStreamFactory
|
||||
/// the FTP URL format specified in RFC 1738.
|
||||
///
|
||||
/// If the URI does not contain a username and password, the
|
||||
/// username "anonymous" and the password "
|
||||
/// username "anonymous" and the password "poco@localhost".
|
||||
{
|
||||
public:
|
||||
FTPStreamFactory();
|
||||
@ -64,13 +64,13 @@ public:
|
||||
|
||||
~FTPStreamFactory();
|
||||
/// Destroys the FTPStreamFactory.
|
||||
|
||||
|
||||
std::istream* open(const Poco::URI& uri);
|
||||
/// Creates and opens a HTTP stream for the given URI.
|
||||
/// The URI must be a ftp://... URI.
|
||||
///
|
||||
/// Throws a NetException if anything goes wrong.
|
||||
|
||||
|
||||
static void setAnonymousPassword(const std::string& password);
|
||||
/// Sets the password used for anonymous FTP.
|
||||
///
|
||||
@ -78,10 +78,10 @@ public:
|
||||
/// thread-safe, so it's best to call this method
|
||||
/// during application initialization, before the
|
||||
/// FTPStreamFactory is used for the first time.
|
||||
|
||||
|
||||
static const std::string& getAnonymousPassword();
|
||||
/// Returns the password used for anonymous FTP.
|
||||
|
||||
|
||||
static void setPasswordProvider(FTPPasswordProvider* pProvider);
|
||||
/// Sets the FTPPasswordProvider. If NULL is given,
|
||||
/// no password provider is used.
|
||||
@ -90,7 +90,7 @@ public:
|
||||
/// thread-safe, so it's best to call this method
|
||||
/// during application initialization, before the
|
||||
/// FTPStreamFactory is used for the first time.
|
||||
|
||||
|
||||
static FTPPasswordProvider* getPasswordProvider();
|
||||
/// Returns the FTPPasswordProvider currently in use,
|
||||
/// or NULL if no one has been set.
|
||||
@ -107,7 +107,7 @@ protected:
|
||||
static void splitUserInfo(const std::string& userInfo, std::string& username, std::string& password);
|
||||
static void getUserInfo(const Poco::URI& uri, std::string& username, std::string& password);
|
||||
static void getPathAndType(const Poco::URI& uri, std::string& path, char& type);
|
||||
|
||||
|
||||
private:
|
||||
static std::string _anonymousPassword;
|
||||
static FTPPasswordProvider* _pPasswordProvider;
|
||||
|
@ -29,9 +29,9 @@ namespace Net {
|
||||
|
||||
|
||||
FTPClientSession::FTPClientSession():
|
||||
_port(0),
|
||||
_pControlSocket(0),
|
||||
_pDataStream(0),
|
||||
_port(FTP_PORT),
|
||||
_passiveMode(true),
|
||||
_fileType(TYPE_BINARY),
|
||||
_supports1738(true),
|
||||
@ -41,12 +41,12 @@ FTPClientSession::FTPClientSession():
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FTPClientSession::FTPClientSession(const StreamSocket& socket):
|
||||
_host(socket.address().host().toString()),
|
||||
_port(socket.address().port()),
|
||||
|
||||
FTPClientSession::FTPClientSession(const StreamSocket& socket, bool readWelcomeMessage):
|
||||
_pControlSocket(new DialogSocket(socket)),
|
||||
_pDataStream(0),
|
||||
_host(socket.address().host().toString()),
|
||||
_port(socket.address().port()),
|
||||
_passiveMode(true),
|
||||
_fileType(TYPE_BINARY),
|
||||
_supports1738(true),
|
||||
@ -55,6 +55,14 @@ FTPClientSession::FTPClientSession(const StreamSocket& socket):
|
||||
_timeout(DEFAULT_TIMEOUT)
|
||||
{
|
||||
_pControlSocket->setReceiveTimeout(_timeout);
|
||||
if (readWelcomeMessage)
|
||||
{
|
||||
receiveServerReadyReply();
|
||||
}
|
||||
else
|
||||
{
|
||||
_serverReady = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -62,10 +70,10 @@ FTPClientSession::FTPClientSession(const std::string& host,
|
||||
Poco::UInt16 port,
|
||||
const std::string& username,
|
||||
const std::string& password):
|
||||
_host(host),
|
||||
_port(port),
|
||||
_pControlSocket(new DialogSocket(SocketAddress(host, port))),
|
||||
_pDataStream(0),
|
||||
_host(host),
|
||||
_port(port),
|
||||
_passiveMode(true),
|
||||
_fileType(TYPE_BINARY),
|
||||
_supports1738(true),
|
||||
@ -73,10 +81,9 @@ FTPClientSession::FTPClientSession(const std::string& host,
|
||||
_isLoggedIn(false),
|
||||
_timeout(DEFAULT_TIMEOUT)
|
||||
{
|
||||
_pControlSocket->setReceiveTimeout(_timeout);
|
||||
if (!username.empty())
|
||||
login(username, password);
|
||||
else
|
||||
_pControlSocket->setReceiveTimeout(_timeout);
|
||||
}
|
||||
|
||||
|
||||
@ -86,7 +93,7 @@ FTPClientSession::~FTPClientSession()
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -101,7 +108,7 @@ void FTPClientSession::setTimeout(const Poco::Timespan& timeout)
|
||||
_pControlSocket->setReceiveTimeout(timeout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Poco::Timespan FTPClientSession::getTimeout() const
|
||||
{
|
||||
return _timeout;
|
||||
@ -114,7 +121,7 @@ void FTPClientSession::setPassive(bool flag, bool useRFC1738)
|
||||
_supports1738 = useRFC1738;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool FTPClientSession::getPassive() const
|
||||
{
|
||||
return _passiveMode;
|
||||
@ -134,12 +141,32 @@ void FTPClientSession::open(const std::string& host,
|
||||
}
|
||||
else
|
||||
{
|
||||
_pControlSocket = new DialogSocket(SocketAddress(_host, _port));
|
||||
_pControlSocket->setReceiveTimeout(_timeout);
|
||||
if (!_pControlSocket)
|
||||
{
|
||||
_pControlSocket = new DialogSocket(SocketAddress(_host, _port));
|
||||
_pControlSocket->setReceiveTimeout(_timeout);
|
||||
}
|
||||
receiveServerReadyReply();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FTPClientSession::receiveServerReadyReply()
|
||||
{
|
||||
if (_serverReady) return;
|
||||
std::string response;
|
||||
int status = _pControlSocket->receiveStatusMessage(response);
|
||||
if (!isPositiveCompletion(status))
|
||||
throw FTPException("Cannot receive status message", response, status);
|
||||
|
||||
{
|
||||
Poco::FastMutex::ScopedLock lock(_wmMutex);
|
||||
_welcomeMessage = response;
|
||||
}
|
||||
_serverReady = true;
|
||||
}
|
||||
|
||||
|
||||
void FTPClientSession::login(const std::string& username, const std::string& password)
|
||||
{
|
||||
if (_isLoggedIn) logout();
|
||||
@ -151,20 +178,12 @@ void FTPClientSession::login(const std::string& username, const std::string& pas
|
||||
_pControlSocket = new DialogSocket(SocketAddress(_host, _port));
|
||||
_pControlSocket->setReceiveTimeout(_timeout);
|
||||
}
|
||||
|
||||
if (!_serverReady)
|
||||
{
|
||||
status = _pControlSocket->receiveStatusMessage(response);
|
||||
if (!isPositiveCompletion(status))
|
||||
throw FTPException("Cannot login to server", response, status);
|
||||
|
||||
_serverReady = true;
|
||||
}
|
||||
receiveServerReadyReply();
|
||||
|
||||
status = sendCommand("USER", username, response);
|
||||
if (isPositiveIntermediate(status))
|
||||
status = sendCommand("PASS", password, response);
|
||||
if (!isPositiveCompletion(status))
|
||||
if (!isPositiveCompletion(status))
|
||||
throw FTPException("Login denied", response, status);
|
||||
|
||||
setFileType(_fileType);
|
||||
@ -179,8 +198,13 @@ void FTPClientSession::logout()
|
||||
|
||||
if (_isLoggedIn)
|
||||
{
|
||||
try { endTransfer(); }
|
||||
catch (...) { }
|
||||
try
|
||||
{
|
||||
endTransfer();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
_isLoggedIn = false;
|
||||
std::string response;
|
||||
sendCommand("QUIT", response);
|
||||
@ -190,8 +214,13 @@ void FTPClientSession::logout()
|
||||
|
||||
void FTPClientSession::close()
|
||||
{
|
||||
try { logout(); }
|
||||
catch (...) {}
|
||||
try
|
||||
{
|
||||
logout();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
_serverReady = false;
|
||||
if (_pControlSocket)
|
||||
{
|
||||
@ -256,24 +285,24 @@ void FTPClientSession::cdup()
|
||||
throw FTPException("Cannot change directory", response, status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FTPClientSession::rename(const std::string& oldName, const std::string& newName)
|
||||
{
|
||||
std::string response;
|
||||
int status = sendCommand("RNFR", oldName, response);
|
||||
if (!isPositiveIntermediate(status))
|
||||
if (!isPositiveIntermediate(status))
|
||||
throw FTPException(std::string("Cannot rename ") + oldName, response, status);
|
||||
status = sendCommand("RNTO", newName, response);
|
||||
if (!isPositiveCompletion(status))
|
||||
if (!isPositiveCompletion(status))
|
||||
throw FTPException(std::string("Cannot rename to ") + newName, response, status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FTPClientSession::remove(const std::string& path)
|
||||
{
|
||||
std::string response;
|
||||
int status = sendCommand("DELE", path, response);
|
||||
if (!isPositiveCompletion(status))
|
||||
if (!isPositiveCompletion(status))
|
||||
throw FTPException(std::string("Cannot remove " + path), response, status);
|
||||
}
|
||||
|
||||
@ -282,7 +311,7 @@ void FTPClientSession::createDirectory(const std::string& path)
|
||||
{
|
||||
std::string response;
|
||||
int status = sendCommand("MKD", path, response);
|
||||
if (!isPositiveCompletion(status))
|
||||
if (!isPositiveCompletion(status))
|
||||
throw FTPException(std::string("Cannot create directory ") + path, response, status);
|
||||
}
|
||||
|
||||
@ -291,7 +320,7 @@ void FTPClientSession::removeDirectory(const std::string& path)
|
||||
{
|
||||
std::string response;
|
||||
int status = sendCommand("RMD", path, response);
|
||||
if (!isPositiveCompletion(status))
|
||||
if (!isPositiveCompletion(status))
|
||||
throw FTPException(std::string("Cannot remove directory ") + path, response, status);
|
||||
}
|
||||
|
||||
@ -307,13 +336,13 @@ std::istream& FTPClientSession::beginDownload(const std::string& path)
|
||||
return *_pDataStream;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FTPClientSession::endDownload()
|
||||
{
|
||||
endTransfer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::ostream& FTPClientSession::beginUpload(const std::string& path)
|
||||
{
|
||||
if (!isOpen())
|
||||
@ -349,7 +378,7 @@ void FTPClientSession::endList()
|
||||
endTransfer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FTPClientSession::abort()
|
||||
{
|
||||
if (!isOpen())
|
||||
@ -361,7 +390,7 @@ void FTPClientSession::abort()
|
||||
int status = sendCommand("ABOR", response);
|
||||
if (status == 426)
|
||||
status = _pControlSocket->receiveStatusMessage(response);
|
||||
if (status != 226)
|
||||
if (status != 226)
|
||||
throw FTPException("Cannot abort transfer", response, status);
|
||||
}
|
||||
|
||||
@ -427,7 +456,7 @@ StreamSocket FTPClientSession::activeDataConnection(const std::string& command,
|
||||
sendPortCommand(server.address());
|
||||
std::string response;
|
||||
int status = sendCommand(command, arg, response);
|
||||
if (!isPositivePreliminary(status))
|
||||
if (!isPositivePreliminary(status))
|
||||
throw FTPException(command + " command failed", response, status);
|
||||
if (server.poll(_timeout, Socket::SELECT_READ))
|
||||
return server.acceptConnection();
|
||||
@ -445,7 +474,7 @@ StreamSocket FTPClientSession::passiveDataConnection(const std::string& command,
|
||||
sock.setSendTimeout(_timeout);
|
||||
std::string response;
|
||||
int status = sendCommand(command, arg, response);
|
||||
if (!isPositivePreliminary(status))
|
||||
if (!isPositivePreliminary(status))
|
||||
throw FTPException(command + " command failed", response, status);
|
||||
return sock;
|
||||
}
|
||||
@ -513,7 +542,7 @@ void FTPClientSession::sendPORT(const SocketAddress& addr)
|
||||
arg += NumberFormatter::format(port % 256);
|
||||
std::string response;
|
||||
int status = sendCommand("PORT", arg, response);
|
||||
if (!isPositiveCompletion(status))
|
||||
if (!isPositiveCompletion(status))
|
||||
throw FTPException("PORT command failed", response, status);
|
||||
}
|
||||
|
||||
@ -539,7 +568,7 @@ void FTPClientSession::sendPASV(SocketAddress& addr)
|
||||
{
|
||||
std::string response;
|
||||
int status = sendCommand("PASV", response);
|
||||
if (!isPositiveCompletion(status))
|
||||
if (!isPositiveCompletion(status))
|
||||
throw FTPException("PASV command failed", response, status);
|
||||
parseAddress(response, addr);
|
||||
}
|
||||
@ -580,8 +609,8 @@ void FTPClientSession::parseExtAddress(const std::string& str, SocketAddress& ad
|
||||
if (it != end && *it == delim) ++it;
|
||||
if (it != end && *it == delim) ++it;
|
||||
Poco::UInt16 port = 0;
|
||||
while (it != end && Poco::Ascii::isDigit(*it)) { port *= 10; port += *it++ - '0'; }
|
||||
addr = SocketAddress(_pControlSocket->peerAddress().host(), port);
|
||||
while (it != end && Poco::Ascii::isDigit(*it)) { port *= 10; port += *it++ - '0'; }
|
||||
addr = SocketAddress(_pControlSocket->peerAddress().host(), port);
|
||||
}
|
||||
|
||||
|
||||
@ -593,7 +622,7 @@ void FTPClientSession::endTransfer()
|
||||
_pDataStream = 0;
|
||||
std::string response;
|
||||
int status = _pControlSocket->receiveStatusMessage(response);
|
||||
if (!isPositiveCompletion(status))
|
||||
if (!isPositiveCompletion(status))
|
||||
throw FTPException("Data transfer failed", response, status);
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,11 @@ objects = AcceptCertificateHandler RejectCertificateHandler ConsoleCertificateHa
|
||||
PrivateKeyPassphraseHandler SecureServerSocket SecureServerSocketImpl \
|
||||
SecureSocketImpl SecureStreamSocket SecureStreamSocketImpl \
|
||||
SSLException SSLManager Utility VerificationErrorArgs \
|
||||
X509Certificate Session SecureSMTPClientSession
|
||||
X509Certificate Session SecureSMTPClientSession \
|
||||
FTPSClientSession FTPSStreamFactory
|
||||
|
||||
target = PocoNetSSL
|
||||
target_version = $(LIBVERSION)
|
||||
target_libs = PocoNet PocoCrypto PocoUtil PocoFoundation
|
||||
target_libs = PocoNet PocoCrypto PocoUtil PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/lib
|
||||
|
@ -551,6 +551,8 @@
|
||||
<ClInclude Include="include\Poco\Net\CertificateHandlerFactoryMgr.h"/>
|
||||
<ClInclude Include="include\Poco\Net\ConsoleCertificateHandler.h"/>
|
||||
<ClInclude Include="include\Poco\Net\Context.h"/>
|
||||
<ClInclude Include="include\Poco\Net\FTPSClientSession.h"/>
|
||||
<ClInclude Include="include\Poco\Net\FTPSStreamFactory.h"/>
|
||||
<ClInclude Include="include\Poco\Net\HTTPSClientSession.h"/>
|
||||
<ClInclude Include="include\Poco\Net\HTTPSSessionInstantiator.h"/>
|
||||
<ClInclude Include="include\Poco\Net\HTTPSStreamFactory.h"/>
|
||||
@ -591,6 +593,12 @@
|
||||
<ClCompile Include="src\Context.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientSession.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSStreamFactory.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\HTTPSClientSession.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
|
@ -2,40 +2,49 @@
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="SSLCore">
|
||||
<UniqueIdentifier>{1d3c9218-bace-4c13-b46a-35c6a5bccba7}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{96483e9a-1b50-4158-a142-f5b002b7cfb7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLCore\Header Files">
|
||||
<UniqueIdentifier>{fd9bec97-ed5d-46bc-a09e-ee2600de92c1}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{30f78015-0f34-4e3c-8cfa-3891e6fff770}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLCore\Source Files">
|
||||
<UniqueIdentifier>{870ae1f0-94e3-4a07-9ebc-936f6cdf24c6}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{4b30214a-17d0-4b49-802c-0adb22df12ec}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient">
|
||||
<UniqueIdentifier>{06f3254e-f624-46d8-b2f8-cb8e70dd4e56}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{82cc816f-cb04-4308-af59-48ad28321e0f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient\Header Files">
|
||||
<UniqueIdentifier>{aa21dbeb-0367-4b3a-b742-398c8c5d09d3}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{20e8d97d-860e-43f0-a299-2c7cb8419b27}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient\Source Files">
|
||||
<UniqueIdentifier>{53247053-60a7-46d7-aec0-371694b53452}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{ead13b96-dcc7-40b3-8272-923482a1b7a6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLSockets">
|
||||
<UniqueIdentifier>{00be4aeb-17ea-4c8a-8fb5-69e9426bb669}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{aabe8d15-cddb-468b-864f-d6766aaaaeba}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLSockets\Header Files">
|
||||
<UniqueIdentifier>{238242b9-aca8-4b2b-9801-5061487e0512}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{8d9c4e00-5f70-433b-90fe-0970c0af3f2b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLSockets\Source Files">
|
||||
<UniqueIdentifier>{5e85139f-74cc-453a-971a-95d246715654}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{c45ddcee-359b-484d-b332-a50c0e142430}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Mail">
|
||||
<UniqueIdentifier>{3b8674d0-cfcb-4a43-b311-89b02d6de0c5}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{7ebf84f2-13a4-495e-bc10-b2b8399f4860}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Mail\Header Files">
|
||||
<UniqueIdentifier>{f8853ab8-67e3-401c-ab18-818ab75d7981}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{3ee151c2-5f61-4502-9bd3-445899b3368c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Mail\Source Files">
|
||||
<UniqueIdentifier>{6723ec97-07f1-4589-8a4b-b33af5b88fa8}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{f293d549-4924-4c8f-9c6d-1f3e3a3b123a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient">
|
||||
<UniqueIdentifier>{3f647633-d450-42d5-85e4-925aed618fa5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient\Header Files">
|
||||
<UniqueIdentifier>{b26ac41f-f190-447d-be3b-a9b84605c3b7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient\Source Files">
|
||||
<UniqueIdentifier>{d3e245cd-0c38-4824-ad2e-a7bf85f63e0f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -123,6 +132,12 @@
|
||||
<ClInclude Include="include\Poco\Net\SecureSMTPClientSession.h">
|
||||
<Filter>Mail\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Poco\Net\FTPSClientSession.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Poco\Net\FTPSStreamFactory.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\AcceptCertificateHandler.cpp">
|
||||
@ -206,6 +221,12 @@
|
||||
<ClCompile Include="src\SecureSMTPClientSession.cpp">
|
||||
<Filter>Mail\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientSession.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSStreamFactory.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\DLLVersion.rc" />
|
||||
|
@ -551,6 +551,8 @@
|
||||
<ClInclude Include="include\Poco\Net\CertificateHandlerFactoryMgr.h"/>
|
||||
<ClInclude Include="include\Poco\Net\ConsoleCertificateHandler.h"/>
|
||||
<ClInclude Include="include\Poco\Net\Context.h"/>
|
||||
<ClInclude Include="include\Poco\Net\FTPSClientSession.h"/>
|
||||
<ClInclude Include="include\Poco\Net\FTPSStreamFactory.h"/>
|
||||
<ClInclude Include="include\Poco\Net\HTTPSClientSession.h"/>
|
||||
<ClInclude Include="include\Poco\Net\HTTPSSessionInstantiator.h"/>
|
||||
<ClInclude Include="include\Poco\Net\HTTPSStreamFactory.h"/>
|
||||
@ -591,6 +593,12 @@
|
||||
<ClCompile Include="src\Context.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientSession.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSStreamFactory.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\HTTPSClientSession.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
|
@ -2,40 +2,49 @@
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="SSLCore">
|
||||
<UniqueIdentifier>{3ac1546f-455e-4e1a-a573-a3bc2f67376d}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{c1fe1744-e6d9-4c5c-be8b-5b2347353ab8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLCore\Header Files">
|
||||
<UniqueIdentifier>{638d5b17-b31a-4098-b5b7-470de82e277a}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{2f2343c8-3c13-49ca-91ed-382baba58367}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLCore\Source Files">
|
||||
<UniqueIdentifier>{de4d9d23-f9a1-491c-bd3c-1d37f8845ee1}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{6d45d521-67ca-4546-84a5-8b8385c4a1c3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient">
|
||||
<UniqueIdentifier>{d9ee32a4-f0c7-4d1e-8344-1ffd9c1745fd}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{0ab4e088-578b-4b65-8da4-dd9c33b6a4e9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient\Header Files">
|
||||
<UniqueIdentifier>{e8ae7926-f411-461a-b627-360af6a8b1bf}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{6ddc4761-6f7f-45e8-b0cf-0169275534a0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient\Source Files">
|
||||
<UniqueIdentifier>{7a5cf97e-bb7d-4662-97ee-31d6fed6e8a3}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{6816061c-9eb0-4f26-acf0-92a30bf7259b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLSockets">
|
||||
<UniqueIdentifier>{91703e48-b778-4064-a20d-df4595897583}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{5f9ddbfa-da6d-4d68-8da5-a72d253cdcdf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLSockets\Header Files">
|
||||
<UniqueIdentifier>{b4dbb8a6-d678-4c0c-a3b4-395fc4aab16b}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{e1cbafc0-08f6-4e0d-aed0-4fb386f40f0a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLSockets\Source Files">
|
||||
<UniqueIdentifier>{d382d85c-e1df-4322-ad02-cbd0323770e9}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{3e5225b0-3762-4b81-80a2-d8d49bdb2f10}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Mail">
|
||||
<UniqueIdentifier>{3d19aa58-55ce-4758-b698-a1e2d6a9e74f}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{2fd53551-b4f1-44b4-9c1a-3df0edeab5b4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Mail\Header Files">
|
||||
<UniqueIdentifier>{a6ab1613-a6fa-489f-8876-fe1c9cc97c25}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{44b74a3e-b34b-47b9-bcfc-eff9bd98188f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Mail\Source Files">
|
||||
<UniqueIdentifier>{be51cadc-28b4-4870-a6a0-28c1ba034e92}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{eee868f5-3208-4572-b2c8-0cd20a4f2729}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient">
|
||||
<UniqueIdentifier>{8be759e7-a7a4-443d-862b-71de0092bb33}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient\Header Files">
|
||||
<UniqueIdentifier>{9a809479-bb66-4ae6-9b51-5e4a5da04e19}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient\Source Files">
|
||||
<UniqueIdentifier>{e4f50cad-0f11-4c1f-b2d1-f21c58e67ccd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -123,6 +132,12 @@
|
||||
<ClInclude Include="include\Poco\Net\SecureSMTPClientSession.h">
|
||||
<Filter>Mail\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Poco\Net\FTPSClientSession.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Poco\Net\FTPSStreamFactory.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\AcceptCertificateHandler.cpp">
|
||||
@ -206,6 +221,12 @@
|
||||
<ClCompile Include="src\SecureSMTPClientSession.cpp">
|
||||
<Filter>Mail\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientSession.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSStreamFactory.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\DLLVersion.rc" />
|
||||
|
@ -551,6 +551,8 @@
|
||||
<ClInclude Include="include\Poco\Net\CertificateHandlerFactoryMgr.h"/>
|
||||
<ClInclude Include="include\Poco\Net\ConsoleCertificateHandler.h"/>
|
||||
<ClInclude Include="include\Poco\Net\Context.h"/>
|
||||
<ClInclude Include="include\Poco\Net\FTPSClientSession.h"/>
|
||||
<ClInclude Include="include\Poco\Net\FTPSStreamFactory.h"/>
|
||||
<ClInclude Include="include\Poco\Net\HTTPSClientSession.h"/>
|
||||
<ClInclude Include="include\Poco\Net\HTTPSSessionInstantiator.h"/>
|
||||
<ClInclude Include="include\Poco\Net\HTTPSStreamFactory.h"/>
|
||||
@ -591,6 +593,12 @@
|
||||
<ClCompile Include="src\Context.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientSession.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSStreamFactory.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\HTTPSClientSession.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
|
@ -2,40 +2,49 @@
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="SSLCore">
|
||||
<UniqueIdentifier>{fdc2240b-109f-49d7-9794-84ab73d05500}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{a907450a-b497-4e1f-a21c-94a99e197c2d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLCore\Header Files">
|
||||
<UniqueIdentifier>{dcb66a89-b9e9-4ee7-980c-5caa41ab7ac1}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{93918e37-d134-42d7-b345-2e60ab41e1f9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLCore\Source Files">
|
||||
<UniqueIdentifier>{0a85a8c0-7a92-444d-8fe6-c182ee114801}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{0a1bfd58-52a7-4c7d-b55d-4ed2d505056b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient">
|
||||
<UniqueIdentifier>{e1002520-3277-44a4-9714-763d0e21f190}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{9d771387-7041-4c75-acd4-3ba1a7ee1159}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient\Header Files">
|
||||
<UniqueIdentifier>{f5048737-45f0-4bf1-96ef-17f6ec7a7766}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{10a12d98-5377-4052-816a-c0b51bedcff2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient\Source Files">
|
||||
<UniqueIdentifier>{30e164e8-e5b5-409b-8c91-b12f4eae7956}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{15231b28-83ac-4cf7-9fd5-21e3332f7850}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLSockets">
|
||||
<UniqueIdentifier>{ab3907d8-a18a-44ea-8451-6aa653cc13c6}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{c9510bba-ee39-4c5b-ab65-f5e007511540}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLSockets\Header Files">
|
||||
<UniqueIdentifier>{565a72c9-dfca-402c-99ab-ee4cd2eec84e}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{313c058b-29ad-47dd-92ca-549a23920413}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SSLSockets\Source Files">
|
||||
<UniqueIdentifier>{e6595db0-64a7-4113-af28-5d99476da61f}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{0fa5153c-28be-4dbc-893f-d9d12147e0f4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Mail">
|
||||
<UniqueIdentifier>{8ef93808-3e6f-4313-ae88-23e3700aa8cd}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{1c539a87-3151-4667-a766-db7a0eac4f0d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Mail\Header Files">
|
||||
<UniqueIdentifier>{1c9fd929-cb33-4b26-b2ac-afe9883f3c49}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{42493a3a-e40e-4ec0-829f-1b79acbe5156}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Mail\Source Files">
|
||||
<UniqueIdentifier>{557d048d-afd8-49ec-a95c-5cb05be4debf}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{e4e19c42-5e42-4e8e-a19d-bf13dcabdeb1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient">
|
||||
<UniqueIdentifier>{ec69f65f-615a-4c71-86b4-9f2a78c07ecf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient\Header Files">
|
||||
<UniqueIdentifier>{c710847c-203f-4940-901b-942d666967f6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient\Source Files">
|
||||
<UniqueIdentifier>{24844a06-9949-446f-99cb-bdeed264e2cb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -123,6 +132,12 @@
|
||||
<ClInclude Include="include\Poco\Net\SecureSMTPClientSession.h">
|
||||
<Filter>Mail\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Poco\Net\FTPSClientSession.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Poco\Net\FTPSStreamFactory.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\AcceptCertificateHandler.cpp">
|
||||
@ -206,6 +221,12 @@
|
||||
<ClCompile Include="src\SecureSMTPClientSession.cpp">
|
||||
<Filter>Mail\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientSession.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSStreamFactory.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\DLLVersion.rc" />
|
||||
|
@ -761,23 +761,37 @@
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="FTPSClient"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Net\FTPSClientSession.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Net\FTPSStreamFactory.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\FTPSClientSession.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\FTPSStreamFactory.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="..\DLLVersion.rc"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="debug_shared|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release_shared|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug_static_mt|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
|
101
NetSSL_OpenSSL/include/Poco/Net/FTPSClientSession.h
Normal file
101
NetSSL_OpenSSL/include/Poco/Net/FTPSClientSession.h
Normal file
@ -0,0 +1,101 @@
|
||||
//
|
||||
// FTPSClientSession.h
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: FTPS
|
||||
// Module: FTPSClientSession
|
||||
//
|
||||
// Definition of the FTPSClientSession class.
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef NetSSL_FTPSClientSession_INCLUDED
|
||||
#define NetSSL_FTPSClientSession_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Net/NetSSL.h"
|
||||
#include "Poco/Net/Context.h"
|
||||
#include "Poco/Net/FTPClientSession.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
class NetSSL_API FTPSClientSession: public Poco::Net::FTPClientSession
|
||||
/// This is an extension of FTPClientSession that supports
|
||||
/// FTP over SSL/TLS using the AUTH SSL/AUTH TLS and PBSZ/PROT
|
||||
/// commands according to RFC 4217.
|
||||
{
|
||||
public:
|
||||
FTPSClientSession();
|
||||
/// Creates an FTPSClientSession.
|
||||
///
|
||||
/// Passive mode will be used for data transfers.
|
||||
|
||||
explicit FTPSClientSession(Context::Ptr pContext);
|
||||
/// Creates an FTPSClientSession using the given Context.
|
||||
///
|
||||
/// Passive mode will be used for data transfers.
|
||||
|
||||
FTPSClientSession(const StreamSocket& socket, bool readWelcomeMessage = true, bool enableFTPS = true, Context::Ptr pContext = nullptr);
|
||||
/// Creates an FTPSClientSession using the given
|
||||
/// connected socket for the control connection.
|
||||
///
|
||||
/// Passive mode will be used for data transfers.
|
||||
|
||||
FTPSClientSession(const std::string& host, Poco::UInt16 port = FTP_PORT, const std::string& username = "", const std::string& password = "", Context::Ptr pContext = nullptr);
|
||||
/// Creates an FTPSClientSession using a socket connected
|
||||
/// to the given host and port. If username is supplied,
|
||||
/// login is attempted.
|
||||
///
|
||||
/// Passive mode will be used for data transfers.
|
||||
|
||||
virtual ~FTPSClientSession();
|
||||
|
||||
void enableFTPS(bool enable = true);
|
||||
/// Enable or disable FTPS (FTP over SSL/TLS).
|
||||
|
||||
bool isSecure() const;
|
||||
/// Returns true if the session is FTPS.
|
||||
|
||||
protected:
|
||||
virtual StreamSocket establishDataConnection(const std::string& command, const std::string& arg);
|
||||
/// Create secure data connection
|
||||
|
||||
virtual void receiveServerReadyReply();
|
||||
/// Function that read server welcome message after connetion and set and make secure socket
|
||||
|
||||
private:
|
||||
void beforeCreateDataSocket();
|
||||
///Send commands to check if we can encrypt data socket
|
||||
|
||||
void afterCreateControlSocket();
|
||||
///Send commands to make SSL negotiating of control channel
|
||||
|
||||
bool _enableFTPS = true;
|
||||
bool _secureDataConnection = false;
|
||||
Context::Ptr _pContext;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline bool FTPSClientSession::isSecure() const
|
||||
{
|
||||
if (_pControlSocket != nullptr)
|
||||
return _pControlSocket->secure();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
||||
|
||||
#endif // #define NetSSL_FTPSClientSession_INCLUDED
|
74
NetSSL_OpenSSL/include/Poco/Net/FTPSStreamFactory.h
Normal file
74
NetSSL_OpenSSL/include/Poco/Net/FTPSStreamFactory.h
Normal file
@ -0,0 +1,74 @@
|
||||
//
|
||||
// FTPSStreamFactory.h
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: FTPS
|
||||
// Module: FTPSStreamFactory
|
||||
//
|
||||
// Definition of the FTPSStreamFactory class.
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Net_FTPSStreamFactory_INCLUDED
|
||||
#define Net_FTPSStreamFactory_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Net/NetSSL.h"
|
||||
#include "Poco/Net/HTTPSession.h"
|
||||
#include "Poco/Net/FTPStreamFactory.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
class NetSSL_API FTPSStreamFactory: public Poco::Net::FTPStreamFactory
|
||||
/// An implementation of the URIStreamFactory interface
|
||||
/// that handles secure File Transfer Protocol (ftps) URIs
|
||||
/// according to RFC 4217, based on the FTPSClientSession class.
|
||||
///
|
||||
/// The URI's path may end with an optional type specification
|
||||
/// in the form (;type=<typecode>), where <typecode> is
|
||||
/// one of a, i or d. If type=a, the file identified by the path
|
||||
/// is transferred in ASCII (text) mode. If type=i, the file
|
||||
/// is transferred in Image (binary) mode. If type=d, a directory
|
||||
/// listing (in NLST format) is returned. This corresponds with
|
||||
/// the FTP URL format specified in RFC 1738.
|
||||
///
|
||||
/// If the URI does not contain a username and password, the
|
||||
/// username "anonymous" and the password "poco@localhost".
|
||||
///
|
||||
/// Note that ftps is a non-standard URI scheme.
|
||||
{
|
||||
public:
|
||||
FTPSStreamFactory();
|
||||
/// Creates the FTPSStreamFactory.
|
||||
|
||||
~FTPSStreamFactory();
|
||||
/// Destroys the FTPSStreamFactory.
|
||||
|
||||
std::istream* open(const Poco::URI& uri);
|
||||
/// Creates and opens a HTTP stream for the given URI.
|
||||
/// The URI must be a ftps://... URI.
|
||||
///
|
||||
/// Throws a NetException if anything goes wrong.
|
||||
|
||||
static void registerFactory();
|
||||
/// Registers the FTPSStreamFactory with the
|
||||
/// default URIStreamOpener instance.
|
||||
|
||||
static void unregisterFactory();
|
||||
/// Unregisters the FTPSStreamFactory with the
|
||||
/// default URIStreamOpener instance.
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
||||
|
||||
#endif // Net_FTPSStreamFactory_INCLUDED
|
@ -19,6 +19,7 @@
|
||||
#include "Poco/Net/HTTPStreamFactory.h"
|
||||
#include "Poco/Net/HTTPSStreamFactory.h"
|
||||
#include "Poco/Net/FTPStreamFactory.h"
|
||||
#include "Poco/Net/FTPSStreamFactory.h"
|
||||
#include "Poco/Net/SSLManager.h"
|
||||
#include "Poco/Net/KeyConsoleHandler.h"
|
||||
#include "Poco/Net/ConsoleCertificateHandler.h"
|
||||
@ -35,6 +36,7 @@ using Poco::Exception;
|
||||
using Poco::Net::HTTPStreamFactory;
|
||||
using Poco::Net::HTTPSStreamFactory;
|
||||
using Poco::Net::FTPStreamFactory;
|
||||
using Poco::Net::FTPSStreamFactory;
|
||||
using Poco::Net::SSLManager;
|
||||
using Poco::Net::Context;
|
||||
using Poco::Net::KeyConsoleHandler;
|
||||
@ -64,6 +66,7 @@ int main(int argc, char** argv)
|
||||
HTTPStreamFactory::registerFactory();
|
||||
HTTPSStreamFactory::registerFactory();
|
||||
FTPStreamFactory::registerFactory();
|
||||
FTPSStreamFactory::registerFactory();
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
|
143
NetSSL_OpenSSL/src/FTPSClientSession.cpp
Normal file
143
NetSSL_OpenSSL/src/FTPSClientSession.cpp
Normal file
@ -0,0 +1,143 @@
|
||||
//
|
||||
// FTPSClientSession.cpp
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: FTPS
|
||||
// Module: FTPSClientSession
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Net/FTPSClientSession.h"
|
||||
#include "Poco/Net/SecureStreamSocket.h"
|
||||
#include "Poco/Net/SecureStreamSocketImpl.h"
|
||||
#include "Poco/Net/SSLManager.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
FTPSClientSession::FTPSClientSession():
|
||||
FTPClientSession()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FTPSClientSession::FTPSClientSession(Context::Ptr pContext):
|
||||
FTPClientSession(),
|
||||
_pContext(pContext)
|
||||
{
|
||||
}
|
||||
|
||||
FTPSClientSession::FTPSClientSession(const StreamSocket& socket, bool readWelcomeMessage, bool enableFTPS, Context::Ptr pContext):
|
||||
FTPClientSession(socket, readWelcomeMessage),
|
||||
_enableFTPS(enableFTPS),
|
||||
_pContext(pContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FTPSClientSession::FTPSClientSession(const std::string& host, Poco::UInt16 port, const std::string& username, const std::string& password, Context::Ptr pContext):
|
||||
FTPClientSession(host, port, username, password),
|
||||
_pContext(pContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FTPSClientSession::~FTPSClientSession()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSession::enableFTPS(bool enable)
|
||||
{
|
||||
_enableFTPS = enable;
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSession::beforeCreateDataSocket()
|
||||
{
|
||||
if (_secureDataConnection) return;
|
||||
_secureDataConnection = false;
|
||||
if (!_pControlSocket->secure()) return;
|
||||
std::string sResponse;
|
||||
int status = sendCommand("PBSZ 0", sResponse);
|
||||
if (isPositiveCompletion(status))
|
||||
{
|
||||
status = sendCommand("PROT P", sResponse);
|
||||
if (isPositiveCompletion(status))
|
||||
{
|
||||
_secureDataConnection = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSession::afterCreateControlSocket()
|
||||
{
|
||||
if (!_enableFTPS) return;
|
||||
_pControlSocket->setNoDelay(true);
|
||||
if (_pControlSocket->secure()) return;
|
||||
|
||||
std::string sResponse;
|
||||
int status = sendCommand("AUTH TLS", sResponse);
|
||||
if (!isPositiveCompletion(status))
|
||||
status = sendCommand("AUTH SSL", sResponse);
|
||||
|
||||
if (isPositiveCompletion(status))
|
||||
{
|
||||
// Server support FTPS
|
||||
try
|
||||
{
|
||||
if (!_pContext) _pContext = Poco::Net::SSLManager::instance().defaultClientContext();
|
||||
Poco::Net::SecureStreamSocket sss(Poco::Net::SecureStreamSocket::attach(*_pControlSocket, _pContext));
|
||||
*_pControlSocket = sss;
|
||||
}
|
||||
catch (Poco::Exception&)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_enableFTPS = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StreamSocket FTPSClientSession::establishDataConnection(const std::string& command, const std::string& arg)
|
||||
{
|
||||
beforeCreateDataSocket();
|
||||
|
||||
StreamSocket ss = FTPClientSession::establishDataConnection(command, arg);
|
||||
ss.setNoDelay(true);
|
||||
|
||||
// SSL nogotiating of data socket
|
||||
if (_secureDataConnection && _pControlSocket->secure())
|
||||
{
|
||||
// We need to reuse the control socket SSL session so the server can ensure that client that opened control socket is the same using data socket
|
||||
Poco::Net::SecureStreamSocketImpl* pSecure = dynamic_cast<Poco::Net::SecureStreamSocketImpl*>(_pControlSocket->impl());
|
||||
if (pSecure != nullptr)
|
||||
{
|
||||
Poco::Net::SecureStreamSocket sss(Poco::Net::SecureStreamSocket::attach(ss, pSecure->context(), pSecure->currentSession()));
|
||||
ss = sss;
|
||||
}
|
||||
}
|
||||
return ss;
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSession::receiveServerReadyReply()
|
||||
{
|
||||
FTPClientSession::receiveServerReadyReply();
|
||||
afterCreateControlSocket();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
161
NetSSL_OpenSSL/src/FTPSStreamFactory.cpp
Normal file
161
NetSSL_OpenSSL/src/FTPSStreamFactory.cpp
Normal file
@ -0,0 +1,161 @@
|
||||
//
|
||||
// FTPSStreamFactory.cpp
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: FTPS
|
||||
// Module: FTPSStreamFactory
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Net/FTPSStreamFactory.h"
|
||||
#include "Poco/Net/FTPSClientSession.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/URI.h"
|
||||
#include "Poco/URIStreamOpener.h"
|
||||
#include "Poco/UnbufferedStreamBuf.h"
|
||||
#include "Poco/Path.h"
|
||||
|
||||
|
||||
using Poco::URIStreamFactory;
|
||||
using Poco::URI;
|
||||
using Poco::URIStreamOpener;
|
||||
using Poco::UnbufferedStreamBuf;
|
||||
using Poco::Path;
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
class FTPSStreamBuf: public UnbufferedStreamBuf
|
||||
{
|
||||
public:
|
||||
FTPSStreamBuf(std::istream& istr):
|
||||
_istr(istr)
|
||||
{
|
||||
// make sure exceptions from underlying string propagate
|
||||
_istr.exceptions(std::ios::badbit);
|
||||
}
|
||||
|
||||
~FTPSStreamBuf()
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
int readFromDevice()
|
||||
{
|
||||
return _istr.get();
|
||||
}
|
||||
|
||||
std::istream& _istr;
|
||||
};
|
||||
|
||||
|
||||
class FTPSIOS: public virtual std::ios
|
||||
{
|
||||
public:
|
||||
FTPSIOS(std::istream& istr):
|
||||
_buf(istr)
|
||||
{
|
||||
poco_ios_init(&_buf);
|
||||
}
|
||||
|
||||
~FTPSIOS()
|
||||
{
|
||||
}
|
||||
|
||||
FTPSStreamBuf* rdbuf()
|
||||
{
|
||||
return &_buf;
|
||||
}
|
||||
|
||||
protected:
|
||||
FTPSStreamBuf _buf;
|
||||
};
|
||||
|
||||
|
||||
class FTPSStream: public FTPSIOS, public std::istream
|
||||
{
|
||||
public:
|
||||
FTPSStream(std::istream& istr, FTPSClientSession* pSession):
|
||||
FTPSIOS(istr),
|
||||
std::istream(&_buf),
|
||||
_pSession(pSession)
|
||||
{
|
||||
}
|
||||
|
||||
~FTPSStream()
|
||||
{
|
||||
delete _pSession;
|
||||
}
|
||||
|
||||
private:
|
||||
FTPSClientSession* _pSession;
|
||||
};
|
||||
|
||||
|
||||
FTPSStreamFactory::FTPSStreamFactory()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FTPSStreamFactory::~FTPSStreamFactory()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::istream* FTPSStreamFactory::open(const URI& uri)
|
||||
{
|
||||
poco_assert (uri.getScheme() == "ftps");
|
||||
|
||||
Poco::UInt16 port = uri.getPort();
|
||||
if (port == 0) port = FTPClientSession::FTP_PORT;
|
||||
FTPSClientSession* pSession = new FTPSClientSession(uri.getHost(), port);
|
||||
try
|
||||
{
|
||||
std::string username;
|
||||
std::string password;
|
||||
getUserInfo(uri, username, password);
|
||||
|
||||
std::string path;
|
||||
char type;
|
||||
getPathAndType(uri, path, type);
|
||||
|
||||
pSession->login(username, password);
|
||||
if (type == 'a')
|
||||
pSession->setFileType(FTPClientSession::TYPE_TEXT);
|
||||
|
||||
Path p(path, Path::PATH_UNIX);
|
||||
p.makeFile();
|
||||
for (int i = 0; i < p.depth(); ++i)
|
||||
pSession->setWorkingDirectory(p[i]);
|
||||
std::string file(p.getFileName());
|
||||
std::istream& istr = (type == 'd' ? pSession->beginList(file) : pSession->beginDownload(file));
|
||||
return new FTPSStream(istr, pSession);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
delete pSession;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FTPSStreamFactory::registerFactory()
|
||||
{
|
||||
URIStreamOpener::defaultOpener().registerStreamFactory("ftps", new FTPSStreamFactory);
|
||||
}
|
||||
|
||||
|
||||
void FTPSStreamFactory::unregisterFactory()
|
||||
{
|
||||
URIStreamOpener::defaultOpener().unregisterStreamFactory("ftps");
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
@ -20,7 +20,8 @@ endif
|
||||
objects = NetSSLTestSuite Driver \
|
||||
HTTPSClientSessionTest HTTPSClientTestSuite HTTPSServerTest HTTPSServerTestSuite \
|
||||
HTTPSStreamFactoryTest HTTPSTestServer TCPServerTest TCPServerTestSuite \
|
||||
WebSocketTest WebSocketTestSuite
|
||||
WebSocketTest WebSocketTestSuite FTPSClientSessionTest FTPSClientTestSuite \
|
||||
DialogServer
|
||||
|
||||
target = testrunner
|
||||
target_version = 1
|
||||
|
@ -598,6 +598,9 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\DialogServer.h"/>
|
||||
<ClInclude Include="src\FTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\FTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\HTTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSServerTest.h"/>
|
||||
@ -611,9 +614,18 @@
|
||||
<ClInclude Include="src\WebSocketTestSuite.h"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\DialogServer.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Driver.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientSessionTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientTestSuite.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
|
@ -2,64 +2,73 @@
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="HTTPS">
|
||||
<UniqueIdentifier>{846e4a5d-b0cc-4266-9719-689933c197da}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{c6547b89-6860-4137-a672-37e448c436a9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPS\Header Files">
|
||||
<UniqueIdentifier>{6a8a9378-129e-4bab-b488-f7b181e88bb4}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{9922b686-f467-4944-916a-110e95983510}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPS\Source Files">
|
||||
<UniqueIdentifier>{f76de951-2eb2-436c-a7ce-563ddbad4616}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{8411c793-1723-459c-85a2-5f0bfb0ea6d5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Suite">
|
||||
<UniqueIdentifier>{589ed19a-a6d6-49a1-8c51-ad939360f2b6}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{00b22986-6a4f-492f-bbb9-af93419c11e1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Suite\Header Files">
|
||||
<UniqueIdentifier>{700574d2-bacd-4825-9909-05ceb3840310}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{48742a87-7ee8-4cdd-bd1b-190cd49e1bdc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Suite\Source Files">
|
||||
<UniqueIdentifier>{b9bd9b82-9c9b-4712-96ff-367aac5246f4}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{8a1d69f1-ebbb-4fb5-b4ee-e146a9409434}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Driver">
|
||||
<UniqueIdentifier>{fd01befb-c10a-4b4f-9383-032472003298}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{96ee466b-e599-47dc-81fa-09af15bd1a11}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Driver\Source Files">
|
||||
<UniqueIdentifier>{def634fb-5af9-4e62-8e27-53c86fbd87c5}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{aa5e42ab-1db8-4ce6-a05b-898ecafcb072}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="TCPServer">
|
||||
<UniqueIdentifier>{61468a62-4980-42c3-ae87-50ec0804b6ad}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{3a31ff9a-47ff-4c1d-af72-8585cdffee41}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="TCPServer\Header Files">
|
||||
<UniqueIdentifier>{af7325c9-0e80-47b0-8c3a-20bf984eabde}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{bd8f9bdf-27d8-41d0-9153-57b60fd78dfb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="TCPServer\Source Files">
|
||||
<UniqueIdentifier>{5668c465-1bd8-434b-bf6c-c7450953c905}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{0e6c338b-237e-4ba4-a4d8-d7ed4c124c09}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSServer">
|
||||
<UniqueIdentifier>{b13c3160-5a0f-4a56-9530-19bb216bda50}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{0edcd961-107d-472d-8c2d-572dcb826bea}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSServer\Header Files">
|
||||
<UniqueIdentifier>{68648587-4ba8-4483-8fe7-5d44f9655131}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{ec2d6581-c268-46c0-8d2b-7896cf207f49}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSServer\Source Files">
|
||||
<UniqueIdentifier>{ec3c8566-0f74-431f-9a9a-625bcaf030a8}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{77d8ee17-7b43-45ed-86bc-504ba591a85b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient">
|
||||
<UniqueIdentifier>{0928e4e6-47c8-445a-be51-19e74ea764c5}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{7722cdda-5ea6-4cd0-9d27-380adefc9355}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient\Header Files">
|
||||
<UniqueIdentifier>{6895fa87-85a2-40f5-822c-86298f4068c2}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{d9814a6f-7743-4f28-967d-10b81f33f62c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient\Source Files">
|
||||
<UniqueIdentifier>{cdbf5ae2-2c80-47dd-ac34-b49ebff2b00c}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{e01d1795-a972-4ddb-8a3e-71cd7d4b1a4a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="WebSocket">
|
||||
<UniqueIdentifier>{3d1ae820-082a-485a-ab2e-00dd7ea965d1}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{3e4f5f38-34e9-4107-8b3a-c1dcb36efbae}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="WebSocket\Header Files">
|
||||
<UniqueIdentifier>{dd22c880-6b1f-4745-912c-f8e3868bba48}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{cbabee5b-4c50-4a71-844c-56bb47c8c1bd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="WebSocket\Source Files">
|
||||
<UniqueIdentifier>{477b6333-4a39-4c91-be58-dc1f645c37fd}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{d73ed15d-80a5-4323-bb9d-08e98f7594b0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient">
|
||||
<UniqueIdentifier>{999c2140-033b-479b-94cd-bec6f46ca093}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient\Header Files">
|
||||
<UniqueIdentifier>{8abcb35f-c8da-4c11-adf9-0632d87ecb7b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient\Source Files">
|
||||
<UniqueIdentifier>{f704361d-028c-45d4-9e90-fe87a7471b67}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -90,11 +99,20 @@
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h">
|
||||
<Filter>HTTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTest.h">
|
||||
<Filter>WebSocket\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTestSuite.h">
|
||||
<Filter>WebSocket\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTest.h">
|
||||
<Filter>WebSocket\Header Files</Filter>
|
||||
<ClInclude Include="src\DialogServer.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\FTPSClientSessionTest.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\FTPSClientTestSuite.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -128,11 +146,20 @@
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp">
|
||||
<Filter>HTTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp">
|
||||
<Filter>WebSocket\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTest.cpp">
|
||||
<Filter>WebSocket\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp">
|
||||
<Filter>WebSocket\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\DialogServer.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientSessionTest.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientTestSuite.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -598,6 +598,9 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\DialogServer.h"/>
|
||||
<ClInclude Include="src\FTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\FTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\HTTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSServerTest.h"/>
|
||||
@ -611,9 +614,18 @@
|
||||
<ClInclude Include="src\WebSocketTestSuite.h"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\DialogServer.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Driver.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientSessionTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientTestSuite.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
|
@ -2,64 +2,73 @@
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="HTTPS">
|
||||
<UniqueIdentifier>{7da80850-8f95-4cac-8d9a-fd45beeb6b3b}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{01dc05f6-66a5-4110-9a48-e7c5183ab097}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPS\Header Files">
|
||||
<UniqueIdentifier>{52a6f3d3-8701-4afb-a6d5-aac3721c192a}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{6d38d9b2-74eb-462a-91ac-acf9984929f2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPS\Source Files">
|
||||
<UniqueIdentifier>{26c56db8-d340-4f40-b74e-91eb6d5a732a}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{761bfbd9-ea4f-4606-a78c-a70578986452}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Suite">
|
||||
<UniqueIdentifier>{6754b60f-da69-498a-83f8-0592418cd121}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{0dd1e2bd-2f57-4125-a224-67a8a337b4a8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Suite\Header Files">
|
||||
<UniqueIdentifier>{6a5bccc4-e1ad-4778-a7bd-ca97aec3a3fd}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{4010adba-7b7a-43d5-88d6-1eb9fcb6b135}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Suite\Source Files">
|
||||
<UniqueIdentifier>{a3810368-bf30-4d9b-a3a4-b72c26433b85}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{908da2b2-3f86-4944-b959-5c7ecddad517}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Driver">
|
||||
<UniqueIdentifier>{b76eefd7-2b80-4cba-93fe-6304918de063}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{b9247cc0-77eb-4553-9141-ac7894e741a9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Driver\Source Files">
|
||||
<UniqueIdentifier>{232acb96-ad00-4fc5-98ee-961d9d15dc0f}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{41417e99-1541-4bd3-96da-5d0282ca819d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="TCPServer">
|
||||
<UniqueIdentifier>{2b8b80cf-1711-4b0a-a123-2e9753e2f9ff}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{e40c88c1-c25c-4db0-a4da-8b719bb05a72}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="TCPServer\Header Files">
|
||||
<UniqueIdentifier>{8df04fb5-81fb-4364-85cf-a728c7c07128}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{1dca29f6-e62d-4ef2-93e6-dfbb1fa68bb5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="TCPServer\Source Files">
|
||||
<UniqueIdentifier>{16d7a0b8-3f6a-4172-909e-f1062bc008db}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{bbd8ae8f-0f7f-4b2e-b823-6205bef6bdc9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSServer">
|
||||
<UniqueIdentifier>{f4db8d5c-7046-40d3-9911-ad9ff764b167}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{d0c42b60-d859-4c29-9a2f-d1a2a945de6a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSServer\Header Files">
|
||||
<UniqueIdentifier>{2b039122-32d1-483d-9af2-5c9bc41c8f3f}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{121d433d-a9e5-4880-86ae-a6dcd38af9bb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSServer\Source Files">
|
||||
<UniqueIdentifier>{c4405010-434d-483b-90d4-966010e572b0}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{65e44aaa-f448-44d0-8c3f-d64c37f7748c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient">
|
||||
<UniqueIdentifier>{9a7c4e30-eee6-4da2-b758-b98a90732e5a}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{f664e993-d511-45ca-91f0-e9c9cb8bf7aa}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient\Header Files">
|
||||
<UniqueIdentifier>{9731e8cb-8bd1-40ce-8de5-814dc69a2467}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{27dd46aa-5898-49e4-ad5a-2c1dd7de3e5c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient\Source Files">
|
||||
<UniqueIdentifier>{95f6ce9b-76ce-451d-8bb6-6a700fb77136}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{32a1145e-6233-4cad-9449-ce036097c6c7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="WebSocket">
|
||||
<UniqueIdentifier>{6857b522-f6ea-4466-be12-1e6000496a18}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{6ca77063-6539-45d2-b1cc-c2e4f03b7d17}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="WebSocket\Header Files">
|
||||
<UniqueIdentifier>{ae31d541-b671-4f2e-af86-158db96fe7a3}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{a197d8c6-61b2-4b3b-9146-47719205e6b0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="WebSocket\Source Files">
|
||||
<UniqueIdentifier>{6783003f-c0e8-4a50-aae0-d939df1534e3}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{1f8fc7ac-627e-4f7a-a7b3-0200c93f0e23}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient">
|
||||
<UniqueIdentifier>{88f10ec6-5da0-4c2a-88ea-16308c0bdff2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient\Header Files">
|
||||
<UniqueIdentifier>{f66ad590-a092-40d6-a48d-18818240730a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient\Source Files">
|
||||
<UniqueIdentifier>{b9cbc9b2-7ed3-40c5-9df5-983ce2b2e7b4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -90,11 +99,20 @@
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h">
|
||||
<Filter>HTTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTest.h">
|
||||
<Filter>WebSocket\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTestSuite.h">
|
||||
<Filter>WebSocket\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTest.h">
|
||||
<Filter>WebSocket\Header Files</Filter>
|
||||
<ClInclude Include="src\DialogServer.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\FTPSClientSessionTest.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\FTPSClientTestSuite.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -128,11 +146,20 @@
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp">
|
||||
<Filter>HTTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp">
|
||||
<Filter>WebSocket\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTest.cpp">
|
||||
<Filter>WebSocket\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp">
|
||||
<Filter>WebSocket\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\DialogServer.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientSessionTest.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientTestSuite.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -598,6 +598,9 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\DialogServer.h"/>
|
||||
<ClInclude Include="src\FTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\FTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\HTTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSServerTest.h"/>
|
||||
@ -611,9 +614,18 @@
|
||||
<ClInclude Include="src\WebSocketTestSuite.h"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\DialogServer.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Driver.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientSessionTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientTestSuite.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
|
@ -2,64 +2,73 @@
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="HTTPS">
|
||||
<UniqueIdentifier>{a065d5fa-8594-4a26-8c66-ff19397b3803}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{3d8c275d-898d-4ba7-82a8-15956f876dd6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPS\Header Files">
|
||||
<UniqueIdentifier>{f2a3a562-f84b-43d5-8a98-145c632e36ce}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{dfdeb6fb-7755-4bc8-aad2-f0c57d4cd444}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPS\Source Files">
|
||||
<UniqueIdentifier>{07ba12d8-f71d-4c60-92ce-43aef9ba7742}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{d105f4d4-8c6e-4f81-9e52-edbe585a6198}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Suite">
|
||||
<UniqueIdentifier>{112ac5c2-2914-4796-8c7a-506b196dc613}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{a961dcb0-a773-4fd8-bf76-47143c6e7bdd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Suite\Header Files">
|
||||
<UniqueIdentifier>{f4b7430a-2047-4e0f-87e0-21a5bd5fc0aa}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{13197bee-9e15-436e-9e9e-57a492a491ec}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Suite\Source Files">
|
||||
<UniqueIdentifier>{b32386db-8f9a-410f-907b-2fb3fb4c8639}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{8003e38f-00bd-4ed8-bab2-61897a705707}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Driver">
|
||||
<UniqueIdentifier>{e80186a3-d7aa-4539-ad73-4cadea7df758}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{45f6628f-f268-4b55-8045-9f4a460b495b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Driver\Source Files">
|
||||
<UniqueIdentifier>{56589647-c44b-4e0e-a6db-e15215cd8fa6}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{db6f4d23-4457-4d18-a456-fffcff8008bf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="TCPServer">
|
||||
<UniqueIdentifier>{5262bd41-0fe9-469e-84c6-4c9c027fedc4}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{c4b2b6c1-5035-4c36-879c-f2a029c82dd5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="TCPServer\Header Files">
|
||||
<UniqueIdentifier>{f493be55-2b0d-4597-9225-4599937f4572}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{5b55cd6b-f15b-4980-be1c-7e00756867c2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="TCPServer\Source Files">
|
||||
<UniqueIdentifier>{7add8e72-a36a-4c27-b9f4-f9261ba0b857}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{e6e773be-05b7-4469-b8c0-0d1c02ef1af3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSServer">
|
||||
<UniqueIdentifier>{c2a70ed3-9822-48c6-9c5f-6f2114061522}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{6a0e39b3-eb47-4c43-a7be-aa4ff14c68a5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSServer\Header Files">
|
||||
<UniqueIdentifier>{402827c6-3af4-4732-af34-a7cca2ed7bea}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{bf42b915-19db-4692-b49d-3896e573a7d1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSServer\Source Files">
|
||||
<UniqueIdentifier>{fa38bc3a-03ce-4b8d-81ca-8eb856f13b5d}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{354f8da0-26b7-4d36-b915-a67561235b2d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient">
|
||||
<UniqueIdentifier>{6e1d8ca4-80fb-40e4-b401-b8fd1a95e996}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{62f97349-a37a-403a-9d32-886672a6f9ac}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient\Header Files">
|
||||
<UniqueIdentifier>{016dd120-6dd9-434c-b5ec-2c85bcfaabe2}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{f1a8189c-ed81-48f3-b1c6-bec5d6678f95}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HTTPSClient\Source Files">
|
||||
<UniqueIdentifier>{64d42661-8f2e-4a72-bfe5-2cb07df554ab}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{77d7e4a1-0101-42c7-8735-cf7c3f033264}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="WebSocket">
|
||||
<UniqueIdentifier>{a437ae7a-17d2-431d-86f4-f47596fdf2e4}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{4a241e53-67d0-4462-99fa-6236a8685ef5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="WebSocket\Header Files">
|
||||
<UniqueIdentifier>{5e248dc9-4df5-4523-b9ae-dd1dd3a37fcb}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{dc8e5a3d-06bc-42e6-89aa-acc155aecb60}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="WebSocket\Source Files">
|
||||
<UniqueIdentifier>{6ebca91a-0a8e-4d6b-97d0-acfe9736401e}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{e95e2b01-d2b6-42c2-9fe3-9ff0ec26fbb6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient">
|
||||
<UniqueIdentifier>{3cc4affd-a6a0-41e4-a88d-68f8dcba1332}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient\Header Files">
|
||||
<UniqueIdentifier>{407782c2-dffa-44cc-8f49-384014f68fec}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="FTPSClient\Source Files">
|
||||
<UniqueIdentifier>{93fa4aa6-9241-4d80-9000-9c9aa10ca383}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -90,11 +99,20 @@
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h">
|
||||
<Filter>HTTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTest.h">
|
||||
<Filter>WebSocket\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTestSuite.h">
|
||||
<Filter>WebSocket\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTest.h">
|
||||
<Filter>WebSocket\Header Files</Filter>
|
||||
<ClInclude Include="src\DialogServer.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\FTPSClientSessionTest.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\FTPSClientTestSuite.h">
|
||||
<Filter>FTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -128,11 +146,20 @@
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp">
|
||||
<Filter>HTTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp">
|
||||
<Filter>WebSocket\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTest.cpp">
|
||||
<Filter>WebSocket\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp">
|
||||
<Filter>WebSocket\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\DialogServer.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientSessionTest.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FTPSClientTestSuite.cpp">
|
||||
<Filter>FTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,16 +1,20 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
Name="TestSuite"
|
||||
Version="9.00"
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="TestSuite"
|
||||
ProjectGUID="{B2B88092-5BCE-4AC0-941E-88167138B4A7}"
|
||||
RootNamespace="TestSuite"
|
||||
Keyword="Win32Proj">
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="0"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles/>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
@ -18,19 +22,26 @@
|
||||
IntermediateDirectory="obj\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
CharacterSet="2">
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions=""
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\include;..\..\CppUnit\include;..\..\openssl\build\include;..\..\Foundation\include;..\..\XML\include;..\..\Util\include;..\..\Net\include;..\..\Crypto\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WINVER=0x0501;"
|
||||
@ -48,39 +59,50 @@
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings=""
|
||||
AdditionalOptions=""/>
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"/>
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="ws2_32.lib iphlpapi.lib"
|
||||
OutputFile="bin\TestSuited.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="bin\TestSuited.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
AdditionalOptions=""/>
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"/>
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"/>
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"/>
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"/>
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"/>
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"/>
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
@ -88,19 +110,26 @@
|
||||
IntermediateDirectory="obj\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
CharacterSet="2">
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions=""
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
@ -120,15 +149,19 @@
|
||||
DebugInformationFormat="0"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings=""
|
||||
AdditionalOptions=""/>
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"/>
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="ws2_32.lib iphlpapi.lib"
|
||||
OutputFile="bin\TestSuite.exe"
|
||||
LinkIncremental="1"
|
||||
@ -138,21 +171,28 @@
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
AdditionalOptions=""/>
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"/>
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"/>
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"/>
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"/>
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"/>
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"/>
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="debug_static_mt|Win32"
|
||||
@ -160,19 +200,26 @@
|
||||
IntermediateDirectory="obj\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
CharacterSet="2">
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions=""
|
||||
Optimization="4"
|
||||
AdditionalIncludeDirectories="..\include;..\..\CppUnit\include;..\..\openssl\build\include;..\..\Foundation\include;..\..\XML\include;..\..\Util\include;..\..\Net\include;..\..\Crypto\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WINVER=0x0501;POCO_STATIC;"
|
||||
@ -190,40 +237,51 @@
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings=""
|
||||
AdditionalOptions=""/>
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"/>
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="Crypt32.lib ws2_32.lib iphlpapi.lib"
|
||||
OutputFile="bin\static_mt\TestSuited.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
IgnoreDefaultLibraryNames="nafxcwd.lib"
|
||||
SuppressStartupBanner="true"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="bin\static_mt\TestSuited.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
AdditionalOptions=""/>
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"/>
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"/>
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"/>
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"/>
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"/>
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"/>
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_static_mt|Win32"
|
||||
@ -231,19 +289,26 @@
|
||||
IntermediateDirectory="obj\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
CharacterSet="2">
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions=""
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
@ -263,15 +328,19 @@
|
||||
DebugInformationFormat="0"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings=""
|
||||
AdditionalOptions=""/>
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"/>
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="Crypt32.lib ws2_32.lib iphlpapi.lib"
|
||||
OutputFile="bin\static_mt\TestSuite.exe"
|
||||
LinkIncremental="1"
|
||||
@ -282,21 +351,28 @@
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
AdditionalOptions=""/>
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"/>
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"/>
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"/>
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"/>
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"/>
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"/>
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="debug_static_md|Win32"
|
||||
@ -304,19 +380,26 @@
|
||||
IntermediateDirectory="obj\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
CharacterSet="2">
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions=""
|
||||
Optimization="4"
|
||||
AdditionalIncludeDirectories="..\include;..\..\CppUnit\include;..\..\openssl\build\include;..\..\Foundation\include;..\..\XML\include;..\..\Util\include;..\..\Net\include;..\..\Crypto\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WINVER=0x0501;POCO_STATIC;"
|
||||
@ -334,39 +417,50 @@
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings=""
|
||||
AdditionalOptions=""/>
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"/>
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="Crypt32.lib ws2_32.lib iphlpapi.lib"
|
||||
OutputFile="bin\static_md\TestSuited.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="bin\static_md\TestSuited.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
AdditionalOptions=""/>
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"/>
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"/>
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"/>
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"/>
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"/>
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"/>
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_static_md|Win32"
|
||||
@ -374,19 +468,26 @@
|
||||
IntermediateDirectory="obj\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
CharacterSet="2">
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions=""
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
@ -406,15 +507,19 @@
|
||||
DebugInformationFormat="0"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings=""
|
||||
AdditionalOptions=""/>
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"/>
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""
|
||||
AdditionalDependencies="Crypt32.lib ws2_32.lib iphlpapi.lib"
|
||||
OutputFile="bin\static_md\TestSuite.exe"
|
||||
LinkIncremental="1"
|
||||
@ -424,131 +529,242 @@
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
AdditionalOptions=""/>
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"/>
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"/>
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"/>
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"/>
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"/>
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"/>
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References/>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="HTTPS">
|
||||
Name="HTTPS"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files">
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\HTTPSTestServer.h"/>
|
||||
RelativePath=".\src\HTTPSTestServer.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files">
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\HTTPSTestServer.cpp"/>
|
||||
RelativePath=".\src\HTTPSTestServer.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="_Suite">
|
||||
Name="_Suite"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files">
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\NetSSLTestSuite.h"/>
|
||||
RelativePath=".\src\NetSSLTestSuite.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files">
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\NetSSLTestSuite.cpp"/>
|
||||
RelativePath=".\src\NetSSLTestSuite.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="_Driver">
|
||||
Name="_Driver"
|
||||
>
|
||||
<Filter
|
||||
Name="Source Files">
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\Driver.cpp"/>
|
||||
RelativePath=".\src\Driver.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="TCPServer">
|
||||
Name="TCPServer"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files">
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\TCPServerTest.h"/>
|
||||
RelativePath=".\src\TCPServerTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\TCPServerTestSuite.h"/>
|
||||
RelativePath=".\src\TCPServerTestSuite.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files">
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\TCPServerTest.cpp"/>
|
||||
RelativePath=".\src\TCPServerTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\TCPServerTestSuite.cpp"/>
|
||||
RelativePath=".\src\TCPServerTestSuite.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="HTTPSServer">
|
||||
Name="HTTPSServer"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files">
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\HTTPSServerTest.h"/>
|
||||
RelativePath=".\src\HTTPSServerTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\HTTPSServerTestSuite.h"/>
|
||||
RelativePath=".\src\HTTPSServerTestSuite.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files">
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\HTTPSServerTest.cpp"/>
|
||||
RelativePath=".\src\HTTPSServerTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\HTTPSServerTestSuite.cpp"/>
|
||||
RelativePath=".\src\HTTPSServerTestSuite.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="HTTPSClient">
|
||||
Name="HTTPSClient"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files">
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\HTTPSClientSessionTest.h"/>
|
||||
RelativePath=".\src\HTTPSClientSessionTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\HTTPSClientTestSuite.h"/>
|
||||
RelativePath=".\src\HTTPSClientTestSuite.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\HTTPSStreamFactoryTest.h"/>
|
||||
RelativePath=".\src\HTTPSStreamFactoryTest.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files">
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\HTTPSClientSessionTest.cpp"/>
|
||||
RelativePath=".\src\HTTPSClientSessionTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\HTTPSClientTestSuite.cpp"/>
|
||||
RelativePath=".\src\HTTPSClientTestSuite.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/>
|
||||
RelativePath=".\src\HTTPSStreamFactoryTest.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="WebSocket">
|
||||
Name="WebSocket"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files">
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\WebSocketTestSuite.h"/>
|
||||
RelativePath=".\src\WebSocketTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\WebSocketTest.h"/>
|
||||
RelativePath=".\src\WebSocketTestSuite.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files">
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\WebSocketTestSuite.cpp"/>
|
||||
RelativePath=".\src\WebSocketTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\WebSocketTest.cpp"/>
|
||||
RelativePath=".\src\WebSocketTestSuite.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="FTPSClient"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\DialogServer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\FTPSClientSessionTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\FTPSClientTestSuite.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\DialogServer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\FTPSClientSessionTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\FTPSClientTestSuite.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals/>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
262
NetSSL_OpenSSL/testsuite/src/DialogServer.cpp
Normal file
262
NetSSL_OpenSSL/testsuite/src/DialogServer.cpp
Normal file
@ -0,0 +1,262 @@
|
||||
//
|
||||
// DialogServer.cpp
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "DialogServer.h"
|
||||
#include "Poco/Net/DialogSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include <iostream>
|
||||
#include "Poco/Net/SecureStreamSocket.h"
|
||||
#include "Poco/Net/SSLManager.h"
|
||||
#include "Poco/Net/Context.h"
|
||||
#include "Poco/Net/SecureStreamSocketImpl.h"
|
||||
|
||||
|
||||
using Poco::Net::Socket;
|
||||
using Poco::Net::DialogSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::FastMutex;
|
||||
using Poco::Thread;
|
||||
using Poco::Net::SecureStreamSocket;
|
||||
using Poco::Net::SSLManager;
|
||||
using Poco::Exception;
|
||||
using Poco::Net::Context;
|
||||
using Poco::Net::Session;
|
||||
using Poco::Net::SecureStreamSocketImpl;
|
||||
|
||||
|
||||
DialogServer::DialogServer(bool acceptCommands, bool ssl):
|
||||
_socket(SocketAddress()),
|
||||
_thread("DialogServer"),
|
||||
_stop(false),
|
||||
_acceptCommands(acceptCommands),
|
||||
_log(false),
|
||||
_ssl(ssl)
|
||||
{
|
||||
_thread.start(*this);
|
||||
_ready.wait();
|
||||
}
|
||||
|
||||
|
||||
DialogServer::~DialogServer()
|
||||
{
|
||||
_stop = true;
|
||||
_thread.join();
|
||||
}
|
||||
|
||||
|
||||
Poco::UInt16 DialogServer::port() const
|
||||
{
|
||||
return _socket.address().port();
|
||||
}
|
||||
|
||||
|
||||
void handleDataSSLrequest(DialogSocket& ds, bool ssl, Session::Ptr& sslSession)
|
||||
{
|
||||
if (ssl)
|
||||
{
|
||||
try
|
||||
{
|
||||
Context::Ptr cDefaultServerContext = SSLManager::instance().defaultServerContext();
|
||||
SecureStreamSocket sss(SecureStreamSocket::attach(ds, cDefaultServerContext, sslSession));
|
||||
sss.setLazyHandshake(true);
|
||||
if (sss.completeHandshake() == 1)
|
||||
{
|
||||
ds = sss;
|
||||
}
|
||||
}
|
||||
catch (Exception& exc)
|
||||
{
|
||||
std::cout << exc.displayText() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void handleSSLrequest(DialogSocket& ds, bool ssl, Session::Ptr& sslSession)
|
||||
{
|
||||
if (ssl)
|
||||
{
|
||||
try
|
||||
{
|
||||
Context::Ptr cDefaultServerContext = SSLManager::instance().defaultServerContext();
|
||||
ds.sendMessage("200 OK");
|
||||
SecureStreamSocket sss(SecureStreamSocket::attach(ds, cDefaultServerContext));
|
||||
sss.setLazyHandshake(true);
|
||||
if (sss.completeHandshake() == 1)
|
||||
{
|
||||
ds = sss;
|
||||
|
||||
SecureStreamSocketImpl* pSecure = dynamic_cast<SecureStreamSocketImpl*>(sss.impl());
|
||||
if (pSecure != nullptr)
|
||||
sslSession = pSecure->currentSession();
|
||||
}
|
||||
else
|
||||
{
|
||||
ds.sendMessage("501 Explicit TLS authentication not available");
|
||||
}
|
||||
}
|
||||
catch (Exception&) {
|
||||
ds.sendMessage("501 Explicit TLS authentication not available");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ds.sendMessage("501 Explicit TLS authentication not available");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DialogServer::run()
|
||||
{
|
||||
_ready.set();
|
||||
Poco::Timespan span(250000);
|
||||
while (!_stop)
|
||||
{
|
||||
if (_socket.poll(span, Socket::SELECT_READ))
|
||||
{
|
||||
DialogSocket ds = _socket.acceptConnection();
|
||||
if (!_SSLsession.isNull()) {
|
||||
handleDataSSLrequest(ds, _ssl, _SSLsession);
|
||||
}
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
if (!_nextResponses.empty())
|
||||
{
|
||||
ds.sendMessage(_nextResponses.front());
|
||||
_nextResponses.erase(_nextResponses.begin());
|
||||
}
|
||||
}
|
||||
if (_acceptCommands)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
std::string command;
|
||||
while (ds.receiveMessage(command))
|
||||
{
|
||||
if ((command == "AUTH TLS") || (command == "AUTH SSL"))
|
||||
{
|
||||
handleSSLrequest(ds, _ssl, _SSLsession);
|
||||
continue;
|
||||
}
|
||||
else if ((command == "PBSZ 0") || (command == "PROT P"))
|
||||
{
|
||||
ds.sendMessage("200 OK");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_log) std::cout << ">> " << command << std::endl;
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
_lastCommands.push_back(command);
|
||||
if (!_nextResponses.empty())
|
||||
{
|
||||
if (_log) std::cout << "<< " << _nextResponses.front() << std::endl;
|
||||
ds.sendMessage(_nextResponses.front());
|
||||
_nextResponses.erase(_nextResponses.begin());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Poco::Exception& exc)
|
||||
{
|
||||
std::cerr << "DialogServer: " << exc.displayText() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const std::string& DialogServer::lastCommand() const
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
static const std::string EMPTY;
|
||||
if (_lastCommands.empty())
|
||||
return EMPTY;
|
||||
else
|
||||
return _lastCommands.back();
|
||||
}
|
||||
|
||||
|
||||
const std::vector<std::string>& DialogServer::lastCommands() const
|
||||
{
|
||||
return _lastCommands;
|
||||
}
|
||||
|
||||
|
||||
std::string DialogServer::popCommand()
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
std::string command;
|
||||
if (!_lastCommands.empty())
|
||||
{
|
||||
command = _lastCommands.front();
|
||||
_lastCommands.erase(_lastCommands.begin());
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
|
||||
std::string DialogServer::popCommandWait()
|
||||
{
|
||||
std::string result(popCommand());
|
||||
while (result.empty())
|
||||
{
|
||||
Thread::sleep(100);
|
||||
result = popCommand();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void DialogServer::addResponse(const std::string& response)
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
_nextResponses.push_back(response);
|
||||
}
|
||||
|
||||
|
||||
void DialogServer::clearCommands()
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
_lastCommands.clear();
|
||||
}
|
||||
|
||||
|
||||
void DialogServer::clearResponses()
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
_nextResponses.clear();
|
||||
}
|
||||
|
||||
|
||||
void DialogServer::log(bool flag)
|
||||
{
|
||||
_log = flag;
|
||||
}
|
||||
|
||||
|
||||
void DialogServer::setSslSession(Session::Ptr cSession)
|
||||
{
|
||||
_SSLsession = cSession;
|
||||
}
|
||||
|
||||
|
||||
Session::Ptr DialogServer::getSslSession()
|
||||
{
|
||||
return _SSLsession;
|
||||
}
|
87
NetSSL_OpenSSL/testsuite/src/DialogServer.h
Normal file
87
NetSSL_OpenSSL/testsuite/src/DialogServer.h
Normal file
@ -0,0 +1,87 @@
|
||||
//
|
||||
// DialogServer.h
|
||||
//
|
||||
// Definition of the DialogServer class.
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DialogServer_INCLUDED
|
||||
#define DialogServer_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Net/ServerSocket.h"
|
||||
#include "Poco/Net/StreamSocket.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/Event.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include <vector>
|
||||
#include "Poco/Net/Session.h"
|
||||
|
||||
|
||||
class DialogServer: public Poco::Runnable
|
||||
/// A server for testing FTPClientSession and friends.
|
||||
{
|
||||
public:
|
||||
DialogServer(bool acceptCommands = true, bool ssl = false);
|
||||
/// Creates the DialogServer.
|
||||
|
||||
~DialogServer();
|
||||
/// Destroys the DialogServer.
|
||||
|
||||
Poco::UInt16 port() const;
|
||||
/// Returns the port the echo server is
|
||||
/// listening on.
|
||||
|
||||
void run();
|
||||
/// Does the work.
|
||||
|
||||
const std::string& lastCommand() const;
|
||||
/// Returns the last command received by the server.
|
||||
|
||||
std::string popCommand();
|
||||
/// Pops the next command from the list of received commands.
|
||||
|
||||
std::string popCommandWait();
|
||||
/// Pops the next command from the list of received commands.
|
||||
/// Waits until a command is available.
|
||||
|
||||
const std::vector<std::string>& lastCommands() const;
|
||||
/// Returns the last command received by the server.
|
||||
|
||||
void addResponse(const std::string& response);
|
||||
/// Sets the next response returned by the server.
|
||||
|
||||
void clearCommands();
|
||||
/// Clears all commands.
|
||||
|
||||
void clearResponses();
|
||||
/// Clears all responses.
|
||||
|
||||
void log(bool flag);
|
||||
/// Enables or disables logging to stdout.
|
||||
|
||||
Poco::Net::Session::Ptr getSslSession();
|
||||
void setSslSession(Poco::Net::Session::Ptr cSession);
|
||||
|
||||
private:
|
||||
Poco::Net::ServerSocket _socket;
|
||||
Poco::Thread _thread;
|
||||
Poco::Event _ready;
|
||||
mutable Poco::FastMutex _mutex;
|
||||
bool _stop;
|
||||
std::vector<std::string> _nextResponses;
|
||||
std::vector<std::string> _lastCommands;
|
||||
bool _acceptCommands;
|
||||
bool _log;
|
||||
bool _ssl;
|
||||
Poco::Net::Session::Ptr _SSLsession = nullptr;
|
||||
};
|
||||
|
||||
|
||||
#endif // DialogServer_INCLUDED
|
647
NetSSL_OpenSSL/testsuite/src/FTPSClientSessionTest.cpp
Normal file
647
NetSSL_OpenSSL/testsuite/src/FTPSClientSessionTest.cpp
Normal file
@ -0,0 +1,647 @@
|
||||
//
|
||||
// FTPSClientSessionTest.cpp
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "FTPSClientSessionTest.h"
|
||||
#include "Poco/CppUnit/TestCaller.h"
|
||||
#include "Poco/CppUnit/TestSuite.h"
|
||||
#include "Poco/Net/FTPSClientSession.h"
|
||||
#include "Poco/Net/DialogSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/ActiveMethod.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include "Poco/Net/Session.h"
|
||||
#include "DialogServer.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Poco::Net::FTPSClientSession;
|
||||
using Poco::Net::DialogSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::FTPException;
|
||||
using Poco::ActiveMethod;
|
||||
using Poco::ActiveResult;
|
||||
using Poco::StreamCopier;
|
||||
using Poco::Thread;
|
||||
using Poco::Net::Session;
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
class ActiveDownloader
|
||||
{
|
||||
public:
|
||||
ActiveDownloader(FTPSClientSession& session):
|
||||
download(this, &ActiveDownloader::downloadImp),
|
||||
_session(session)
|
||||
{
|
||||
}
|
||||
|
||||
ActiveMethod<std::string, std::string, ActiveDownloader> download;
|
||||
|
||||
protected:
|
||||
std::string downloadImp(const std::string& path)
|
||||
{
|
||||
std::istream& istr = _session.beginDownload(path);
|
||||
std::ostringstream ostr;
|
||||
StreamCopier::copyStream(istr, ostr);
|
||||
_session.endDownload();
|
||||
return ostr.str();
|
||||
}
|
||||
|
||||
private:
|
||||
FTPSClientSession& _session;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
FTPSClientSessionTest::FTPSClientSessionTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FTPSClientSessionTest::~FTPSClientSessionTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::login(DialogServer& server, FTPSClientSession& session)
|
||||
{
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
session.login("user", "password");
|
||||
std::string cmd = server.popCommand();
|
||||
assertTrue (cmd == "USER user");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "PASS password");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "TYPE I");
|
||||
|
||||
assertTrue (session.getFileType() == FTPSClientSession::TYPE_BINARY);
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testLogin1()
|
||||
{
|
||||
DialogServer server;
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
FTPSClientSession session("127.0.0.1", server.port());
|
||||
assertTrue (session.isOpen());
|
||||
assertTrue (!session.isLoggedIn());
|
||||
login(server, session);
|
||||
assertTrue (session.isOpen());
|
||||
assertTrue (session.isLoggedIn());
|
||||
server.addResponse("221 Good Bye");
|
||||
session.logout();
|
||||
assertTrue (session.isOpen());
|
||||
assertTrue (!session.isLoggedIn());
|
||||
|
||||
server.clearCommands();
|
||||
server.clearResponses();
|
||||
|
||||
session.enableFTPS(true);
|
||||
login(server, session);
|
||||
assertTrue (session.isOpen());
|
||||
assertTrue (session.isLoggedIn());
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
assertTrue (!session.isOpen());
|
||||
assertTrue (!session.isLoggedIn());
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testLogin2()
|
||||
{
|
||||
DialogServer server;
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
Poco::UInt16 serverPort = server.port();
|
||||
FTPSClientSession session("127.0.0.1", serverPort, "user", "password");
|
||||
assertTrue (session.isOpen());
|
||||
assertTrue (session.isLoggedIn());
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
assertTrue (!session.isOpen());
|
||||
assertTrue (!session.isLoggedIn());
|
||||
|
||||
server.clearCommands();
|
||||
server.clearResponses();
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
session.enableFTPS(true);
|
||||
session.open("127.0.0.1", serverPort, "user", "password");
|
||||
assertTrue (session.isOpen());
|
||||
assertTrue (session.isLoggedIn());
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
assertTrue (!session.isOpen());
|
||||
assertTrue (!session.isLoggedIn());
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testLogin3()
|
||||
{
|
||||
DialogServer server;
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
FTPSClientSession session;
|
||||
assertTrue (!session.isOpen());
|
||||
assertTrue (!session.isLoggedIn());
|
||||
session.open("127.0.0.1", server.port(), "user", "password");
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
assertTrue (!session.isOpen());
|
||||
assertTrue (!session.isLoggedIn());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testLoginFailed1()
|
||||
{
|
||||
DialogServer server;
|
||||
server.addResponse("421 localhost FTP not ready");
|
||||
FTPSClientSession session("127.0.0.1", server.port());
|
||||
try
|
||||
{
|
||||
session.login("user", "password");
|
||||
fail("server not ready - must throw");
|
||||
}
|
||||
catch (FTPException&)
|
||||
{
|
||||
}
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testLoginFailed2()
|
||||
{
|
||||
DialogServer server;
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("530 Login incorrect");
|
||||
FTPSClientSession session("127.0.0.1", server.port());
|
||||
try
|
||||
{
|
||||
session.login("user", "password");
|
||||
fail("login incorrect - must throw");
|
||||
}
|
||||
catch (FTPException&)
|
||||
{
|
||||
}
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testCommands()
|
||||
{
|
||||
DialogServer server;
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
FTPSClientSession session("127.0.0.1", server.port());
|
||||
session.login("user", "password");
|
||||
std::string cmd = server.popCommand();
|
||||
assertTrue (cmd == "USER user");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "PASS password");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "TYPE I");
|
||||
|
||||
// systemType
|
||||
server.clearCommands();
|
||||
server.addResponse("215 UNIX Type: L8 Version: dummyFTP 1.0");
|
||||
std::string type = session.systemType();
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "SYST");
|
||||
assertTrue (type == "UNIX Type: L8 Version: dummyFTP 1.0");
|
||||
|
||||
// getWorkingDirectory
|
||||
server.addResponse("257 \"/usr/test\" is current directory");
|
||||
std::string cwd = session.getWorkingDirectory();
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "PWD");
|
||||
assertTrue (cwd == "/usr/test");
|
||||
|
||||
// getWorkingDirectory (quotes in filename)
|
||||
server.addResponse("257 \"\"\"quote\"\"\" is current directory");
|
||||
cwd = session.getWorkingDirectory();
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "PWD");
|
||||
assertTrue (cwd == "\"quote\"");
|
||||
|
||||
// setWorkingDirectory
|
||||
server.addResponse("250 CWD OK");
|
||||
session.setWorkingDirectory("test");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "CWD test");
|
||||
|
||||
server.addResponse("250 CDUP OK");
|
||||
session.cdup();
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "CDUP");
|
||||
|
||||
// rename
|
||||
server.addResponse("350 File exists, send destination name");
|
||||
server.addResponse("250 Rename OK");
|
||||
session.rename("old.txt", "new.txt");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "RNFR old.txt");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "RNTO new.txt");
|
||||
|
||||
// rename (failing)
|
||||
server.addResponse("550 not found");
|
||||
try
|
||||
{
|
||||
session.rename("old.txt", "new.txt");
|
||||
fail("not found - must throw");
|
||||
}
|
||||
catch (FTPException&)
|
||||
{
|
||||
}
|
||||
server.clearCommands();
|
||||
|
||||
// remove
|
||||
server.addResponse("250 delete ok");
|
||||
session.remove("test.txt");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "DELE test.txt");
|
||||
|
||||
// remove (failing)
|
||||
server.addResponse("550 not found");
|
||||
try
|
||||
{
|
||||
session.remove("test.txt");
|
||||
fail("not found - must throw");
|
||||
}
|
||||
catch (FTPException&)
|
||||
{
|
||||
}
|
||||
server.clearCommands();
|
||||
|
||||
// createDirectory
|
||||
server.addResponse("257 dir created");
|
||||
session.createDirectory("foo");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "MKD foo");
|
||||
|
||||
// createDirectory (failing)
|
||||
server.addResponse("550 exists");
|
||||
try
|
||||
{
|
||||
session.createDirectory("foo");
|
||||
fail("not found - must throw");
|
||||
}
|
||||
catch (FTPException&)
|
||||
{
|
||||
}
|
||||
server.clearCommands();
|
||||
|
||||
// removeDirectory
|
||||
server.addResponse("250 RMD OK");
|
||||
session.removeDirectory("foo");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "RMD foo");
|
||||
|
||||
// removeDirectory (failing)
|
||||
server.addResponse("550 not found");
|
||||
try
|
||||
{
|
||||
session.removeDirectory("foo");
|
||||
fail("not found - must throw");
|
||||
}
|
||||
catch (FTPException&)
|
||||
{
|
||||
}
|
||||
server.clearCommands();
|
||||
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testDownloadPORT()
|
||||
{
|
||||
DialogServer server;
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
FTPSClientSession session("127.0.0.1", server.port());
|
||||
session.setPassive(false);
|
||||
session.login("user", "password");
|
||||
server.clearCommands();
|
||||
|
||||
server.addResponse("500 EPRT not understood");
|
||||
server.addResponse("200 PORT OK");
|
||||
server.addResponse("150 Sending data\r\n226 Transfer complete");
|
||||
|
||||
ActiveDownloader dl(session);
|
||||
ActiveResult<std::string> result = dl.download("test.txt");
|
||||
|
||||
std::string cmd = server.popCommandWait();
|
||||
assertTrue (cmd.substr(0, 4) == "EPRT");
|
||||
|
||||
cmd = server.popCommandWait();
|
||||
assertTrue (cmd.substr(0, 4) == "PORT");
|
||||
|
||||
std::string dummy;
|
||||
int x, lo, hi;
|
||||
for (std::string::iterator it = cmd.begin(); it != cmd.end(); ++it)
|
||||
{
|
||||
if (*it == ',') *it = ' ';
|
||||
}
|
||||
std::istringstream istr(cmd);
|
||||
istr >> dummy >> x >> x >> x >> x >> hi >> lo;
|
||||
int port = hi*256 + lo;
|
||||
|
||||
cmd = server.popCommandWait();
|
||||
assertTrue (cmd == "RETR test.txt");
|
||||
|
||||
SocketAddress sa("127.0.0.1", (Poco::UInt16) port);
|
||||
DialogSocket dataSock;
|
||||
dataSock.connect(sa);
|
||||
|
||||
std::string data("This is some data");
|
||||
dataSock.sendString(data);
|
||||
dataSock.close();
|
||||
|
||||
result.wait();
|
||||
std::string received = result.data();
|
||||
assertTrue (received == data);
|
||||
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testDownloadEPRT()
|
||||
{
|
||||
DialogServer server;
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
FTPSClientSession session("127.0.0.1", server.port());
|
||||
session.setPassive(false);
|
||||
session.login("user", "password");
|
||||
server.clearCommands();
|
||||
|
||||
server.addResponse("200 EPRT OK");
|
||||
server.addResponse("150 Sending data\r\n226 Transfer complete");
|
||||
|
||||
ActiveDownloader dl(session);
|
||||
ActiveResult<std::string> result = dl.download("test.txt");
|
||||
|
||||
std::string cmd = server.popCommandWait();
|
||||
assertTrue (cmd.substr(0, 4) == "EPRT");
|
||||
|
||||
std::string dummy;
|
||||
char c;
|
||||
int d;
|
||||
int port;
|
||||
std::istringstream istr(cmd);
|
||||
istr >> dummy >> c >> d >> c >> d >> c >> d >> c >> d >> c >> d >> c >> port >> c;
|
||||
|
||||
cmd = server.popCommandWait();
|
||||
assertTrue (cmd == "RETR test.txt");
|
||||
|
||||
SocketAddress sa("127.0.0.1", (Poco::UInt16) port);
|
||||
DialogSocket dataSock;
|
||||
dataSock.connect(sa);
|
||||
|
||||
std::string data("This is some data");
|
||||
dataSock.sendString(data);
|
||||
dataSock.close();
|
||||
|
||||
result.wait();
|
||||
std::string received = result.data();
|
||||
assertTrue (received == data);
|
||||
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testDownloadPASV()
|
||||
{
|
||||
DialogServer server;
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
FTPSClientSession session("127.0.0.1", server.port());
|
||||
session.login("user", "password");
|
||||
server.clearCommands();
|
||||
|
||||
server.addResponse("500 EPSV not understood");
|
||||
|
||||
DialogServer dataServer(false);
|
||||
Poco::UInt16 dataServerPort = dataServer.port();
|
||||
dataServer.addResponse("This is some data");
|
||||
std::ostringstream pasv;
|
||||
pasv << "227 Entering Passive Mode (127,0,0,1," << (dataServerPort/256) << "," << (dataServerPort % 256) << ")";
|
||||
server.addResponse(pasv.str());
|
||||
server.addResponse("150 sending data\r\n226 Transfer complete");
|
||||
|
||||
std::istream& istr = session.beginDownload("test.txt");
|
||||
std::ostringstream dataStr;
|
||||
StreamCopier::copyStream(istr, dataStr);
|
||||
session.endDownload();
|
||||
std::string s(dataStr.str());
|
||||
assertTrue (s == "This is some data\r\n");
|
||||
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testDownloadEPSV()
|
||||
{
|
||||
DialogServer server;
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
FTPSClientSession session("127.0.0.1", server.port());
|
||||
session.login("user", "password");
|
||||
server.clearCommands();
|
||||
|
||||
DialogServer dataServer(false);
|
||||
dataServer.addResponse("This is some data");
|
||||
std::ostringstream epsv;
|
||||
epsv << "229 Entering Extended Passive Mode (|||" << dataServer.port() << "|)";
|
||||
server.addResponse(epsv.str());
|
||||
server.addResponse("150 sending data\r\n226 Transfer complete");
|
||||
|
||||
std::istream& istr = session.beginDownload("test.txt");
|
||||
std::ostringstream dataStr;
|
||||
StreamCopier::copyStream(istr, dataStr);
|
||||
session.endDownload();
|
||||
std::string s(dataStr.str());
|
||||
assertTrue (s == "This is some data\r\n");
|
||||
|
||||
std::string cmd = server.popCommand();
|
||||
assertTrue (cmd.substr(0, 4) == "EPSV");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "RETR test.txt");
|
||||
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testUpload()
|
||||
{
|
||||
DialogServer server;
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
FTPSClientSession session("127.0.0.1", server.port());
|
||||
session.login("user", "password");
|
||||
server.clearCommands();
|
||||
|
||||
DialogServer dataServer;
|
||||
std::ostringstream epsv;
|
||||
epsv << "229 Entering Extended Passive Mode (|||" << dataServer.port() << "|)";
|
||||
server.addResponse(epsv.str());
|
||||
server.addResponse("150 send data\r\n226 Transfer complete");
|
||||
|
||||
std::ostream& ostr = session.beginUpload("test.txt");
|
||||
ostr << "This is some data\r\n";
|
||||
session.endUpload();
|
||||
std::string s(dataServer.popCommandWait());
|
||||
assertTrue (s == "This is some data");
|
||||
|
||||
std::string cmd = server.popCommand();
|
||||
assertTrue (cmd.substr(0, 4) == "EPSV");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "STOR test.txt");
|
||||
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testUploadSSL()
|
||||
{
|
||||
DialogServer server(true, true);
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
FTPSClientSession session("127.0.0.1", server.port());
|
||||
session.login("user", "password");
|
||||
server.clearCommands();
|
||||
|
||||
DialogServer dataServer(true, true);
|
||||
Session::Ptr cSessionSSL = server.getSslSession();
|
||||
dataServer.setSslSession(cSessionSSL);
|
||||
|
||||
std::ostringstream epsv;
|
||||
epsv << "229 Entering Extended Passive Mode (|||" << dataServer.port() << "|)";
|
||||
server.addResponse(epsv.str());
|
||||
server.addResponse("150 send data\r\n226 Transfer complete");
|
||||
|
||||
std::ostream& ostr = session.beginUpload("test.txt");
|
||||
ostr << "This is some data\r\n";
|
||||
session.endUpload();
|
||||
//std::string s(dataServer.popCommandWait());
|
||||
//assertTrue (s == "This is some data");
|
||||
|
||||
std::string cmd = server.popCommand();
|
||||
assertTrue (cmd.substr(0, 4) == "EPSV");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "STOR test.txt");
|
||||
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::testList()
|
||||
{
|
||||
DialogServer server;
|
||||
server.addResponse("220 localhost FTP ready");
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
FTPSClientSession session("127.0.0.1", server.port());
|
||||
session.login("user", "password");
|
||||
server.clearCommands();
|
||||
|
||||
DialogServer dataServer(false);
|
||||
dataServer.addResponse("file1\r\nfile2");
|
||||
std::ostringstream epsv;
|
||||
epsv << "229 Entering Extended Passive Mode (|||" << dataServer.port() << "|)";
|
||||
server.addResponse(epsv.str());
|
||||
server.addResponse("150 sending data\r\n226 Transfer complete");
|
||||
|
||||
std::istream& istr = session.beginList();
|
||||
std::ostringstream dataStr;
|
||||
StreamCopier::copyStream(istr, dataStr);
|
||||
session.endList();
|
||||
std::string s(dataStr.str());
|
||||
assertTrue (s == "file1\r\nfile2\r\n");
|
||||
|
||||
std::string cmd = server.popCommand();
|
||||
assertTrue (cmd.substr(0, 4) == "EPSV");
|
||||
cmd = server.popCommand();
|
||||
assertTrue (cmd == "NLST");
|
||||
|
||||
server.addResponse("221 Good Bye");
|
||||
session.close();
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void FTPSClientSessionTest::tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test* FTPSClientSessionTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("FTPSClientSessionTest");
|
||||
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testLogin1);
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testLogin2);
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testLogin3);
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testLoginFailed1);
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testLoginFailed2);
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testCommands);
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testDownloadPORT);
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testDownloadEPRT);
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testDownloadPASV);
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testDownloadEPSV);
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testUpload);
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testList);
|
||||
CppUnit_addTest(pSuite, FTPSClientSessionTest, testUploadSSL);
|
||||
|
||||
return pSuite;
|
||||
}
|
62
NetSSL_OpenSSL/testsuite/src/FTPSClientSessionTest.h
Normal file
62
NetSSL_OpenSSL/testsuite/src/FTPSClientSessionTest.h
Normal file
@ -0,0 +1,62 @@
|
||||
//
|
||||
// FTPClientSessionTest.h
|
||||
//
|
||||
// Definition of the FTPClientSessionTest class.
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef FTPClientSessionTest_INCLUDED
|
||||
#define FTPClientSessionTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/CppUnit/TestCase.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
class FTPSClientSession;
|
||||
|
||||
} }
|
||||
|
||||
|
||||
class DialogServer;
|
||||
|
||||
|
||||
class FTPSClientSessionTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
FTPSClientSessionTest(const std::string& name);
|
||||
~FTPSClientSessionTest();
|
||||
|
||||
void testLogin1();
|
||||
void testLogin2();
|
||||
void testLogin3();
|
||||
void testLoginFailed1();
|
||||
void testLoginFailed2();
|
||||
void testCommands();
|
||||
void testDownloadPORT();
|
||||
void testDownloadEPRT();
|
||||
void testDownloadPASV();
|
||||
void testDownloadEPSV();
|
||||
void testUpload();
|
||||
void testList();
|
||||
void testUploadSSL();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
void login(DialogServer& server, Poco::Net::FTPSClientSession& session);
|
||||
};
|
||||
|
||||
|
||||
#endif // FTPClientSessionTest_INCLUDED
|
22
NetSSL_OpenSSL/testsuite/src/FTPSClientTestSuite.cpp
Normal file
22
NetSSL_OpenSSL/testsuite/src/FTPSClientTestSuite.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// FTPClientTestSuite.cpp
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "FTPSClientTestSuite.h"
|
||||
#include "FTPSClientSessionTest.h"
|
||||
|
||||
|
||||
CppUnit::Test* FTPSClientTestSuite::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("FTPSClientTestSuite");
|
||||
|
||||
pSuite->addTest(FTPSClientSessionTest::suite());
|
||||
|
||||
return pSuite;
|
||||
}
|
27
NetSSL_OpenSSL/testsuite/src/FTPSClientTestSuite.h
Normal file
27
NetSSL_OpenSSL/testsuite/src/FTPSClientTestSuite.h
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// FTPClientTestSuite.h
|
||||
//
|
||||
// Definition of the FTPClientTestSuite class.
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef FTPClientTestSuite_INCLUDED
|
||||
#define FTPClientTestSuite_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/CppUnit/TestSuite.h"
|
||||
|
||||
|
||||
class FTPSClientTestSuite
|
||||
{
|
||||
public:
|
||||
static CppUnit::Test* suite();
|
||||
};
|
||||
|
||||
|
||||
#endif // FTPClientTestSuite_INCLUDED
|
@ -14,6 +14,7 @@
|
||||
#include "TCPServerTestSuite.h"
|
||||
#include "HTTPSServerTestSuite.h"
|
||||
#include "WebSocketTestSuite.h"
|
||||
#include "FTPSClientTestSuite.h"
|
||||
|
||||
|
||||
CppUnit::Test* NetSSLTestSuite::suite()
|
||||
@ -24,6 +25,7 @@ CppUnit::Test* NetSSLTestSuite::suite()
|
||||
pSuite->addTest(TCPServerTestSuite::suite());
|
||||
pSuite->addTest(HTTPSServerTestSuite::suite());
|
||||
pSuite->addTest(WebSocketTestSuite::suite());
|
||||
pSuite->addTest(FTPSClientTestSuite::suite());
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user