Added tls flag to Url

This commit is contained in:
BenDroid 2018-02-09 20:16:07 +01:00
parent f97a7fb121
commit bcbda15832
2 changed files with 8 additions and 2 deletions

View file

@ -58,6 +58,7 @@ Url::Url() :
* @param url
*/
Url::Url(const char *url) :
m_tls(false),
m_keepAlive(false),
m_nicehash(false),
m_host(nullptr),
@ -69,7 +70,8 @@ Url::Url(const char *url) :
}
Url::Url(const char *host, uint16_t port, const char *user, const char *password, bool keepAlive, bool nicehash) :
Url::Url(const char *host, uint16_t port, const char *user, const char *password, bool tls, bool keepAlive, bool nicehash) :
m_tls(tls),
m_keepAlive(keepAlive),
m_nicehash(nicehash),
m_password(password ? strdup(password) : nullptr),
@ -180,6 +182,7 @@ void Url::setUser(const char *user)
Url &Url::operator=(const Url *other)
{
m_tls = other->m_tls;
m_keepAlive = other->m_keepAlive;
m_nicehash = other->m_nicehash;
m_port = other->m_port;

View file

@ -37,9 +37,10 @@ public:
Url();
Url(const char *url);
Url(const char *host, uint16_t port, const char *user = nullptr, const char *password = nullptr, bool keepAlive = false, bool nicehash = false );
Url(const char *host, uint16_t port, const char *user = nullptr, const char *password = nullptr, bool tls = false, bool keepAlive = false, bool nicehash = false );
~Url();
inline bool isTls() const { return m_tls; }
inline bool isKeepAlive() const { return m_keepAlive; }
inline bool isNicehash() const { return m_nicehash; }
inline bool isValid() const { return m_host && m_port > 0; }
@ -47,6 +48,7 @@ public:
inline const char *password() const { return m_password ? m_password : kDefaultPassword; }
inline const char *user() const { return m_user ? m_user : kDefaultUser; }
inline uint16_t port() const { return m_port; }
inline void setTls(bool tls) { m_tls = tls; }
inline void setKeepAlive(bool keepAlive) { m_keepAlive = keepAlive; }
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
@ -59,6 +61,7 @@ public:
Url &operator=(const Url *other);
private:
bool m_tls;
bool m_keepAlive;
bool m_nicehash;
char *m_host;