mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 22:02:49 -06:00
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:
parent
c0dea5dff1
commit
04b10ecca1
6 changed files with 98 additions and 20 deletions
33
uppsrc/Web/SSL/httpscli.cpp
Normal file
33
uppsrc/Web/SSL/httpscli.cpp
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue