First version of HttpsClient (using SSL)

git-svn-id: svn://ultimatepp.org/upp/trunk@2042 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
rylek 2010-02-09 19:19:06 +00:00
parent c0dea5dff1
commit 04b10ecca1
6 changed files with 98 additions and 20 deletions

View file

@ -0,0 +1,33 @@
#ifndef flagNOSSL
#include "WebSSL.h"
NAMESPACE_UPP
HttpsClient::HttpsClient()
{
secure = true;
}
bool HttpsClient::CreateClientSocket()
{
if(!secure)
return HttpClient::CreateClientSocket();
if(!ssl_context) {
ssl_context = new SSLContext;
if(!ssl_context->Create(SSLv3_client_method())) {
error = t_("Error creating SSL context.");
return false;
}
}
if(!SSLClientSocket(socket, *ssl_context, socket_host, socket_port, true, NULL, 0, false)) {
error = Socket::GetErrorText();
return false;
}
socket.Linger(0);
return true;
}
END_UPP_NAMESPACE
#endif