mrtazz / restclient-cpp

C++ client for making HTTP/REST requests
http://code.mrtazz.com/restclient-cpp/
MIT License
1.57k stars 377 forks source link

void Connection::SetVerifyPeer(bool _verifyPeer) is not usefule to ignore peer verification #197

Open Jiwangreal opened 7 months ago

Jiwangreal commented 7 months ago

In Connection::performCurlRequest Function, you need add the CURLOPT_SSL_VERIFYHOST curl option to avoid peer verification check.

file:connection.cc


old:
    // set peer verification
    if (!this->verifyPeer)
    {
        curl_easy_setopt(
            getCurlHandle(), CURLOPT_SSL_VERIFYPEER, this->verifyPeer);
    }

new

    // set peer verification
    if (!this->verifyPeer)
    {
        curl_easy_setopt(
            getCurlHandle(), CURLOPT_SSL_VERIFYHOST, this->verifyPeer);
        curl_easy_setopt(
            getCurlHandle(), CURLOPT_SSL_VERIFYPEER, this->verifyPeer);
    }