Unverified Commit f6973e50 authored by Dennis Jenkins's avatar Dennis Jenkins Committed by GitHub

Merge pull request #654 from dennisjenkins75/master

Fixed many cppcheck warnings for non-explicit single-argument constructors.
Converted https unit tests to use ephemeral TCP ports instead of fixed ports.
parents 4257a90c 7de4ea32
...@@ -31,7 +31,7 @@ namespace Async { ...@@ -31,7 +31,7 @@ namespace Async {
class BadType : public Error { class BadType : public Error {
public: public:
BadType(TypeId id) explicit BadType(TypeId id)
: Error("Argument type can not be used to resolve the promise " : Error("Argument type can not be used to resolve the promise "
" (TypeId does not match)") " (TypeId does not match)")
, id_(std::move(id)) , id_(std::move(id))
...@@ -139,7 +139,7 @@ namespace Async { ...@@ -139,7 +139,7 @@ namespace Async {
namespace Private { namespace Private {
struct InternalRethrow { struct InternalRethrow {
InternalRethrow(std::exception_ptr _exc) explicit InternalRethrow(std::exception_ptr _exc)
: exc(std::move(_exc)) : exc(std::move(_exc))
{ } { }
...@@ -280,7 +280,7 @@ namespace Async { ...@@ -280,7 +280,7 @@ namespace Async {
template<typename T> template<typename T>
struct Continuable : public Request { struct Continuable : public Request {
Continuable(const std::shared_ptr<Core>& chain) explicit Continuable(const std::shared_ptr<Core>& chain)
: resolveCount_(0) : resolveCount_(0)
, rejectCount_(0) , rejectCount_(0)
, chain_(chain) , chain_(chain)
...@@ -545,7 +545,7 @@ namespace Async { ...@@ -545,7 +545,7 @@ namespace Async {
template<typename PromiseType> template<typename PromiseType>
struct Chainer { struct Chainer {
Chainer(const std::shared_ptr<Private::Core>& core) explicit Chainer(const std::shared_ptr<Private::Core>& core)
: chainCore(core) : chainCore(core)
{ } { }
...@@ -619,7 +619,7 @@ namespace Async { ...@@ -619,7 +619,7 @@ namespace Async {
template<typename PromiseType, typename Dummy = void> template<typename PromiseType, typename Dummy = void>
struct Chainer { struct Chainer {
Chainer(const std::shared_ptr<Private::Core>& core) explicit Chainer(const std::shared_ptr<Private::Core>& core)
: chainCore(core) : chainCore(core)
{ } { }
...@@ -635,7 +635,7 @@ namespace Async { ...@@ -635,7 +635,7 @@ namespace Async {
template<typename Dummy> template<typename Dummy>
struct Chainer<void, Dummy> { struct Chainer<void, Dummy> {
Chainer(const std::shared_ptr<Private::Core>& core) explicit Chainer(const std::shared_ptr<Private::Core>& core)
: chainCore(core) : chainCore(core)
{ } { }
...@@ -749,7 +749,7 @@ namespace Async { ...@@ -749,7 +749,7 @@ namespace Async {
class Resolver { class Resolver {
public: public:
Resolver(const std::shared_ptr<Private::Core> &core) explicit Resolver(const std::shared_ptr<Private::Core> &core)
: core_(core) : core_(core)
{ } { }
...@@ -819,7 +819,7 @@ namespace Async { ...@@ -819,7 +819,7 @@ namespace Async {
class Rejection { class Rejection {
public: public:
Rejection(const std::shared_ptr<Private::Core>& core) explicit Rejection(const std::shared_ptr<Private::Core>& core)
: core_(core) : core_(core)
{ } { }
...@@ -978,7 +978,7 @@ namespace Async { ...@@ -978,7 +978,7 @@ namespace Async {
typedef Private::CoreT<T> Core; typedef Private::CoreT<T> Core;
template<typename Func> template<typename Func>
Promise(Func func) explicit Promise(Func func)
: core_(std::make_shared<Core>()) : core_(std::make_shared<Core>())
, resolver_(core_) , resolver_(core_)
, rejection_(core_) , rejection_(core_)
...@@ -1075,7 +1075,7 @@ namespace Async { ...@@ -1075,7 +1075,7 @@ namespace Async {
{ {
} }
Promise(std::shared_ptr<Core>&& core) explicit Promise(std::shared_ptr<Core>&& core)
: core_(core) : core_(core)
, resolver_(core_) , resolver_(core_)
, rejection_(core_) , rejection_(core_)
...@@ -1089,7 +1089,7 @@ namespace Async { ...@@ -1089,7 +1089,7 @@ namespace Async {
template<typename T> template<typename T>
class Barrier { class Barrier {
public: public:
Barrier(Promise<T>& promise) explicit Barrier(Promise<T>& promise)
: promise_(promise) { : promise_(promise) {
} }
...@@ -1158,7 +1158,7 @@ namespace Async { ...@@ -1158,7 +1158,7 @@ namespace Async {
} }
private: private:
Any(const std::shared_ptr<Private::Core>& core) explicit Any(const std::shared_ptr<Private::Core>& core)
: core_(core) : core_(core)
{ } { }
std::shared_ptr<Private::Core> core_; std::shared_ptr<Private::Core> core_;
...@@ -1297,7 +1297,7 @@ namespace Async { ...@@ -1297,7 +1297,7 @@ namespace Async {
private: private:
template<typename T, size_t Index, typename Data> template<typename T, size_t Index, typename Data>
struct WhenContinuation { struct WhenContinuation {
WhenContinuation(Data _data) explicit WhenContinuation(Data _data)
: data(std::move(_data)) : data(std::move(_data))
{ } { }
...@@ -1310,7 +1310,7 @@ namespace Async { ...@@ -1310,7 +1310,7 @@ namespace Async {
template<size_t Index, typename Data> template<size_t Index, typename Data>
struct WhenContinuation<void, Index, Data> { struct WhenContinuation<void, Index, Data> {
WhenContinuation(Data _data) explicit WhenContinuation(Data _data)
: data(std::move(_data)) : data(std::move(_data))
{ } { }
......
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
using Storage = std::unordered_map<std::string, HashMapCookies>; // "name" -> Hashmap("value" -> Cookie) using Storage = std::unordered_map<std::string, HashMapCookies>; // "name" -> Hashmap("value" -> Cookie)
struct iterator : std::iterator<std::bidirectional_iterator_tag, Cookie> { struct iterator : std::iterator<std::bidirectional_iterator_tag, Cookie> {
iterator(const Storage::const_iterator& _iterator) explicit iterator(const Storage::const_iterator& _iterator)
: iter_storage(_iterator) : iter_storage(_iterator)
, iter_cookie_values() , iter_cookie_values()
, iter_storage_end() , iter_storage_end()
......
...@@ -97,7 +97,7 @@ namespace Uri { ...@@ -97,7 +97,7 @@ namespace Uri {
class Query { class Query {
public: public:
Query(); Query();
Query(std::initializer_list<std::pair<const std::string, std::string>> params); explicit Query(std::initializer_list<std::pair<const std::string, std::string>> params);
void add(std::string name, std::string value); void add(std::string name, std::string value);
Optional<std::string> get(const std::string& name) const; Optional<std::string> get(const std::string& name) const;
......
...@@ -192,7 +192,7 @@ public: ...@@ -192,7 +192,7 @@ public:
AscTime AscTime
}; };
FullDate(time_point date) explicit FullDate(time_point date)
: date_(date) : date_(date)
{ } { }
......
...@@ -14,7 +14,7 @@ struct FlatMapIteratorAdapter { ...@@ -14,7 +14,7 @@ struct FlatMapIteratorAdapter {
typedef typename Map::mapped_type Value; typedef typename Map::mapped_type Value;
typedef typename Map::const_iterator const_iterator; typedef typename Map::const_iterator const_iterator;
FlatMapIteratorAdapter(const_iterator _it) explicit FlatMapIteratorAdapter(const_iterator _it)
: it(_it) : it(_it)
{ } { }
......
...@@ -162,7 +162,7 @@ public: ...@@ -162,7 +162,7 @@ public:
} }
template < class U > template < class U >
Entry( U&& u ) : explicit Entry( U&& u ) :
storage(), storage(),
next(nullptr) next(nullptr)
{ {
...@@ -355,6 +355,7 @@ public: ...@@ -355,6 +355,7 @@ public:
enqueueIndex.store(other.enqueueIndex.load(), std::memory_order_relaxed); enqueueIndex.store(other.enqueueIndex.load(), std::memory_order_relaxed);
dequeueIndex.store(other.enqueueIndex.load(), std::memory_order_relaxed); dequeueIndex.store(other.enqueueIndex.load(), std::memory_order_relaxed);
return *this;
} }
MPMCQueue() MPMCQueue()
......
...@@ -134,7 +134,7 @@ public: ...@@ -134,7 +134,7 @@ public:
, q_() , q_()
{ } { }
MediaType(std::string raw, Parse parse = DontParse) explicit MediaType(std::string raw, Parse parse = DontParse)
: top_(Type::None) : top_(Type::None)
, sub_(Subtype::None) , sub_(Subtype::None)
, suffix_(Suffix::None) , suffix_(Suffix::None)
......
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
IP(); IP();
IP(uint8_t a, uint8_t b, uint8_t c, uint8_t d); IP(uint8_t a, uint8_t b, uint8_t c, uint8_t d);
IP(uint16_t a, uint16_t b, uint16_t c, uint16_t d, uint16_t e, uint16_t f, uint16_t g, uint16_t h); IP(uint16_t a, uint16_t b, uint16_t c, uint16_t d, uint16_t e, uint16_t f, uint16_t g, uint16_t h);
IP(struct sockaddr *); explicit IP(struct sockaddr *);
static IP any(); static IP any();
static IP loopback(); static IP loopback();
static IP any(bool ipv6); static IP any(bool ipv6);
...@@ -133,8 +133,8 @@ class Address { ...@@ -133,8 +133,8 @@ class Address {
public: public:
Address(); Address();
Address(std::string host, Port port); Address(std::string host, Port port);
Address(std::string addr); explicit Address(std::string addr);
Address(const char* addr); explicit Address(const char* addr);
Address(IP ip, Port port); Address(IP ip, Port port);
Address(const Address& other) = default; Address(const Address& other) = default;
...@@ -157,8 +157,8 @@ private: ...@@ -157,8 +157,8 @@ private:
class Error : public std::runtime_error { class Error : public std::runtime_error {
public: public:
Error(const char* message); explicit Error(const char* message);
Error(std::string message); explicit Error(std::string message);
static Error system(const char* message); static Error system(const char* message);
}; };
......
...@@ -37,9 +37,9 @@ public: ...@@ -37,9 +37,9 @@ public:
friend class Transport; friend class Transport;
Peer(); Peer();
Peer(const Address& addr); explicit Peer(const Address& addr);
~Peer(); ~Peer();
const Address& address() const; const Address& address() const;
const std::string& hostname(); const std::string& hostname();
......
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
} }
template<size_t M> template<size_t M>
ArrayStreamBuf(char (&arr)[M]) { explicit ArrayStreamBuf(char (&arr)[M]) {
bytes.clear(); bytes.clear();
std::copy(arr, arr + M, std::back_inserter(bytes)); std::copy(arr, arr + M, std::back_inserter(bytes));
Base::setg(bytes.data(), bytes.data(), bytes.data() + bytes.size()); Base::setg(bytes.data(), bytes.data(), bytes.data() + bytes.size());
...@@ -160,7 +160,7 @@ public: ...@@ -160,7 +160,7 @@ public:
static size_t maxSize; static size_t maxSize;
DynamicStreamBuf( size_t size ) explicit DynamicStreamBuf( size_t size )
: data_() : data_()
{ {
reserve(size); reserve(size);
...@@ -202,7 +202,7 @@ private: ...@@ -202,7 +202,7 @@ private:
class StreamCursor { class StreamCursor {
public: public:
StreamCursor(StreamBuf<char>* _buf, size_t initialPos = 0) explicit StreamCursor(StreamBuf<char>* _buf, size_t initialPos = 0)
: buf(_buf) : buf(_buf)
{ {
advance(initialPos); advance(initialPos);
...@@ -211,7 +211,7 @@ public: ...@@ -211,7 +211,7 @@ public:
static constexpr int Eof = -1; static constexpr int Eof = -1;
struct Token { struct Token {
Token(StreamCursor& _cursor) explicit Token(StreamCursor& _cursor)
: cursor(_cursor) : cursor(_cursor)
, position(cursor.buf->position()) , position(cursor.buf->position())
, eback(cursor.buf->begptr()) , eback(cursor.buf->begptr())
...@@ -246,7 +246,7 @@ public: ...@@ -246,7 +246,7 @@ public:
}; };
struct Revert { struct Revert {
Revert(StreamCursor& _cursor) explicit Revert(StreamCursor& _cursor)
: cursor(_cursor) : cursor(_cursor)
, eback(cursor.buf->begptr()) , eback(cursor.buf->begptr())
, gptr(cursor.buf->curptr()) , gptr(cursor.buf->curptr())
......
...@@ -39,7 +39,7 @@ namespace std { ...@@ -39,7 +39,7 @@ namespace std {
constexpr string_view(const char *s, size_type count) : data_(s), size_(count) { } constexpr string_view(const char *s, size_type count) : data_(s), size_(count) { }
string_view(const char *s) : data_(s), size_(strlen(s)) { } explicit string_view(const char *s) : data_(s), size_(strlen(s)) { }
string_view string_view
......
...@@ -186,7 +186,7 @@ private: ...@@ -186,7 +186,7 @@ private:
}; };
struct PeerEntry { struct PeerEntry {
PeerEntry(std::shared_ptr<Peer> peer_) explicit PeerEntry(std::shared_ptr<Peer> peer_)
: peer(std::move(peer_)) : peer(std::move(peer_))
{ } { }
......
...@@ -31,7 +31,7 @@ public: ...@@ -31,7 +31,7 @@ public:
private: private:
typedef void const* Id; typedef void const* Id;
TypeId(Id id) explicit TypeId(Id id)
: id_(id) : id_(id)
{ } { }
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
using namespace Pistache; using namespace Pistache;
#define ADDRESS "localhost:907"
/* _ALL_ those tests should fail around 2020, when the certificates will expire */ /* _ALL_ those tests should fail around 2020, when the certificates will expire */
static size_t write_cb(void *contents, size_t size, size_t nmemb, void *userp) static size_t write_cb(void *contents, size_t size, size_t nmemb, void *userp)
...@@ -20,6 +18,10 @@ static size_t write_cb(void *contents, size_t size, size_t nmemb, void *userp) ...@@ -20,6 +18,10 @@ static size_t write_cb(void *contents, size_t size, size_t nmemb, void *userp)
return size * nmemb; return size * nmemb;
} }
static std::string getServerUrl(const Http::Endpoint &server) {
return std::string("https://localhost:") + server.getPort().toString();
}
struct HelloHandler : public Http::Handler { struct HelloHandler : public Http::Handler {
HTTP_PROTOTYPE(HelloHandler) HTTP_PROTOTYPE(HelloHandler)
...@@ -39,7 +41,7 @@ struct ServeFileHandler : public Http::Handler { ...@@ -39,7 +41,7 @@ struct ServeFileHandler : public Http::Handler {
}; };
TEST(http_client_test, basic_tls_request) { TEST(http_client_test, basic_tls_request) {
Http::Endpoint server(ADDRESS "1"); Http::Endpoint server(Address("localhost", Pistache::Port(0)));
auto flags = Tcp::Options::ReuseAddr; auto flags = Tcp::Options::ReuseAddr;
auto server_opts = Http::Endpoint::options().flags(flags); auto server_opts = Http::Endpoint::options().flags(flags);
...@@ -56,7 +58,8 @@ TEST(http_client_test, basic_tls_request) { ...@@ -56,7 +58,8 @@ TEST(http_client_test, basic_tls_request) {
curl = curl_easy_init(); curl = curl_easy_init();
ASSERT_NE(curl, nullptr); ASSERT_NE(curl, nullptr);
curl_easy_setopt(curl, CURLOPT_URL, "https://" ADDRESS "1"); const auto url = getServerUrl(server);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_CAINFO, "./certs/rootCA.crt"); curl_easy_setopt(curl, CURLOPT_CAINFO, "./certs/rootCA.crt");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &write_cb); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &write_cb);
...@@ -76,7 +79,7 @@ TEST(http_client_test, basic_tls_request) { ...@@ -76,7 +79,7 @@ TEST(http_client_test, basic_tls_request) {
} }
TEST(http_client_test, basic_tls_request_with_auth) { TEST(http_client_test, basic_tls_request_with_auth) {
Http::Endpoint server(ADDRESS "2"); Http::Endpoint server(Address("localhost", Pistache::Port(0)));
auto flags = Tcp::Options::ReuseAddr; auto flags = Tcp::Options::ReuseAddr;
auto server_opts = Http::Endpoint::options().flags(flags); auto server_opts = Http::Endpoint::options().flags(flags);
...@@ -94,7 +97,8 @@ TEST(http_client_test, basic_tls_request_with_auth) { ...@@ -94,7 +97,8 @@ TEST(http_client_test, basic_tls_request_with_auth) {
curl = curl_easy_init(); curl = curl_easy_init();
ASSERT_NE(curl, nullptr); ASSERT_NE(curl, nullptr);
curl_easy_setopt(curl, CURLOPT_URL, "https://" ADDRESS "2"); const auto url = getServerUrl(server);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_SSLCERT, "./certs/client.crt"); curl_easy_setopt(curl, CURLOPT_SSLCERT, "./certs/client.crt");
curl_easy_setopt(curl, CURLOPT_SSLKEY, "./certs/client.key"); curl_easy_setopt(curl, CURLOPT_SSLKEY, "./certs/client.key");
curl_easy_setopt(curl, CURLOPT_CAINFO, "./certs/rootCA.crt"); curl_easy_setopt(curl, CURLOPT_CAINFO, "./certs/rootCA.crt");
...@@ -117,7 +121,7 @@ TEST(http_client_test, basic_tls_request_with_auth) { ...@@ -117,7 +121,7 @@ TEST(http_client_test, basic_tls_request_with_auth) {
} }
TEST(http_client_test, basic_tls_request_with_auth_no_client_cert) { TEST(http_client_test, basic_tls_request_with_auth_no_client_cert) {
Http::Endpoint server(ADDRESS "3"); Http::Endpoint server(Address("localhost", Pistache::Port(0)));
auto flags = Tcp::Options::ReuseAddr; auto flags = Tcp::Options::ReuseAddr;
auto server_opts = Http::Endpoint::options().flags(flags); auto server_opts = Http::Endpoint::options().flags(flags);
...@@ -135,7 +139,8 @@ TEST(http_client_test, basic_tls_request_with_auth_no_client_cert) { ...@@ -135,7 +139,8 @@ TEST(http_client_test, basic_tls_request_with_auth_no_client_cert) {
curl = curl_easy_init(); curl = curl_easy_init();
ASSERT_NE(curl, nullptr); ASSERT_NE(curl, nullptr);
curl_easy_setopt(curl, CURLOPT_URL, "https://" ADDRESS "3"); const auto url = getServerUrl(server);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_CAINFO, "./certs/rootCA.crt"); curl_easy_setopt(curl, CURLOPT_CAINFO, "./certs/rootCA.crt");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1);
...@@ -155,7 +160,7 @@ TEST(http_client_test, basic_tls_request_with_auth_no_client_cert) { ...@@ -155,7 +160,7 @@ TEST(http_client_test, basic_tls_request_with_auth_no_client_cert) {
} }
TEST(http_client_test, basic_tls_request_with_auth_client_cert_not_signed) { TEST(http_client_test, basic_tls_request_with_auth_client_cert_not_signed) {
Http::Endpoint server(ADDRESS "4"); Http::Endpoint server(Address("localhost", Pistache::Port(0)));
auto flags = Tcp::Options::ReuseAddr; auto flags = Tcp::Options::ReuseAddr;
auto server_opts = Http::Endpoint::options().flags(flags); auto server_opts = Http::Endpoint::options().flags(flags);
...@@ -173,7 +178,8 @@ TEST(http_client_test, basic_tls_request_with_auth_client_cert_not_signed) { ...@@ -173,7 +178,8 @@ TEST(http_client_test, basic_tls_request_with_auth_client_cert_not_signed) {
curl = curl_easy_init(); curl = curl_easy_init();
ASSERT_NE(curl, nullptr); ASSERT_NE(curl, nullptr);
curl_easy_setopt(curl, CURLOPT_URL, "https://" ADDRESS "4"); const auto url = getServerUrl(server);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_SSLCERT, "./certs/client_not_signed.crt"); curl_easy_setopt(curl, CURLOPT_SSLCERT, "./certs/client_not_signed.crt");
curl_easy_setopt(curl, CURLOPT_SSLKEY, "./certs/client_not_signed.key"); curl_easy_setopt(curl, CURLOPT_SSLKEY, "./certs/client_not_signed.key");
curl_easy_setopt(curl, CURLOPT_CAINFO, "./certs/rootCA.crt"); curl_easy_setopt(curl, CURLOPT_CAINFO, "./certs/rootCA.crt");
...@@ -206,7 +212,7 @@ static int verify_callback(int verify, void *ctx) ...@@ -206,7 +212,7 @@ static int verify_callback(int verify, void *ctx)
TEST(http_client_test, basic_tls_request_with_auth_with_cb) { TEST(http_client_test, basic_tls_request_with_auth_with_cb) {
Http::Endpoint server(ADDRESS "5"); Http::Endpoint server(Address("localhost", Pistache::Port(0)));
auto flags = Tcp::Options::ReuseAddr; auto flags = Tcp::Options::ReuseAddr;
auto server_opts = Http::Endpoint::options().flags(flags); auto server_opts = Http::Endpoint::options().flags(flags);
...@@ -224,7 +230,8 @@ TEST(http_client_test, basic_tls_request_with_auth_with_cb) { ...@@ -224,7 +230,8 @@ TEST(http_client_test, basic_tls_request_with_auth_with_cb) {
curl = curl_easy_init(); curl = curl_easy_init();
ASSERT_NE(curl, nullptr); ASSERT_NE(curl, nullptr);
curl_easy_setopt(curl, CURLOPT_URL, "https://" ADDRESS "5"); const auto url = getServerUrl(server);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_SSLCERT, "./certs/client.crt"); curl_easy_setopt(curl, CURLOPT_SSLCERT, "./certs/client.crt");
curl_easy_setopt(curl, CURLOPT_SSLKEY, "./certs/client.key"); curl_easy_setopt(curl, CURLOPT_SSLKEY, "./certs/client.key");
curl_easy_setopt(curl, CURLOPT_CAINFO, "./certs/rootCA.crt"); curl_easy_setopt(curl, CURLOPT_CAINFO, "./certs/rootCA.crt");
...@@ -249,7 +256,7 @@ TEST(http_client_test, basic_tls_request_with_auth_with_cb) { ...@@ -249,7 +256,7 @@ TEST(http_client_test, basic_tls_request_with_auth_with_cb) {
} }
TEST(http_client_test, basic_tls_request_with_servefile) { TEST(http_client_test, basic_tls_request_with_servefile) {
Http::Endpoint server(ADDRESS "6"); Http::Endpoint server(Address("localhost", Pistache::Port(0)));
auto flags = Tcp::Options::ReuseAddr; auto flags = Tcp::Options::ReuseAddr;
auto server_opts = Http::Endpoint::options().flags(flags); auto server_opts = Http::Endpoint::options().flags(flags);
...@@ -266,7 +273,8 @@ TEST(http_client_test, basic_tls_request_with_servefile) { ...@@ -266,7 +273,8 @@ TEST(http_client_test, basic_tls_request_with_servefile) {
curl = curl_easy_init(); curl = curl_easy_init();
ASSERT_NE(curl, nullptr); ASSERT_NE(curl, nullptr);
curl_easy_setopt(curl, CURLOPT_URL, "https://" ADDRESS "6"); const auto url = getServerUrl(server);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_CAINFO, "./certs/rootCA.crt"); curl_easy_setopt(curl, CURLOPT_CAINFO, "./certs/rootCA.crt");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &write_cb); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &write_cb);
...@@ -292,4 +300,3 @@ TEST(http_client_test, basic_tls_request_with_servefile) { ...@@ -292,4 +300,3 @@ TEST(http_client_test, basic_tls_request_with_servefile) {
server.shutdown(); server.shutdown();
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment