0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 20:13:05 +02:00

In HTTP client (httpcli.hpp):

* Added Request::set_creds() method.

* In HTTPCore, added a virtual destructor that calls stop().

* Added is_alive() method.

* In HTTPDelegate class template, detach() method now accepts
  a keepalive parameter.

* Added HTTPDelegate::attach() method.
This commit is contained in:
James Yonan 2015-09-18 10:58:46 -07:00 committed by Lev Stipakov
parent dd5b4980ff
commit f811dfd42c
No known key found for this signature in database
GPG Key ID: 88670BE258B9C258

View File

@ -57,6 +57,7 @@
#include <openvpn/transport/tcplink.hpp>
#include <openvpn/transport/client/transbase.hpp>
#include <openvpn/ws/httpcommon.hpp>
#include <openvpn/ws/httpcreds.hpp>
namespace openvpn {
namespace WS {
@ -166,6 +167,12 @@ namespace openvpn {
};
struct Request {
void set_creds(const Creds& creds)
{
username = creds.username;
password = creds.password;
}
std::string method;
std::string uri;
std::string username;
@ -214,6 +221,16 @@ namespace openvpn {
{
}
virtual ~HTTPCore()
{
stop();
}
bool is_alive() const
{
return alive;
}
void start_request()
{
if (!is_ready())
@ -833,6 +850,21 @@ namespace openvpn {
{
}
void attach(PARENT* parent_arg)
{
parent = parent_arg;
}
void detach(const bool keepalive=false)
{
if (parent)
{
parent = nullptr;
if (!keepalive)
stop();
}
}
virtual Host http_host()
{
if (parent)
@ -909,15 +941,6 @@ namespace openvpn {
parent->http_keepalive_close(*this, status, description);
}
void detach()
{
if (parent)
{
parent = nullptr;
stop();
}
}
private:
PARENT* parent;
};