You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by fg...@apache.org on 2024/11/12 20:02:00 UTC

(nifi-minifi-cpp) 01/03: MINIFICPP-2486 Simplify code around https

This is an automated email from the ASF dual-hosted git repository.

fgerlits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 9bcf7e49467f09e8b42c071c7bce08984a8854b4
Author: Marton Szasz <sz...@apache.org>
AuthorDate: Mon Nov 4 23:03:54 2024 +0100

    MINIFICPP-2486 Simplify code around https
    
    Signed-off-by: Ferenc Gerlits <fg...@gmail.com>
    This closes #1890
---
 extensions/standard-processors/processors/InvokeHTTP.cpp |  1 -
 libminifi/include/http/BaseHTTPClient.h                  |  3 ---
 libminifi/include/http/HTTPClient.h                      |  3 ---
 libminifi/src/http/HTTPClient.cpp                        | 15 ---------------
 4 files changed, 22 deletions(-)

diff --git a/extensions/standard-processors/processors/InvokeHTTP.cpp b/extensions/standard-processors/processors/InvokeHTTP.cpp
index 6049630ac..36e3614d4 100644
--- a/extensions/standard-processors/processors/InvokeHTTP.cpp
+++ b/extensions/standard-processors/processors/InvokeHTTP.cpp
@@ -127,7 +127,6 @@ std::unique_ptr<minifi::http::HTTPClient> InvokeHTTP::createHTTPClientFromMember
   setupClientTimeouts(*client, connect_timeout_, read_timeout_);
   client->setHTTPProxy(proxy_);
   client->setFollowRedirects(follow_redirects_);
-  client->setPeerVerification(true);
   if (send_message_body_ && content_type_)
     client->setContentType(*content_type_);
   setupClientTransferEncoding(*client, use_chunked_encoding_);
diff --git a/libminifi/include/http/BaseHTTPClient.h b/libminifi/include/http/BaseHTTPClient.h
index 005cf27a0..48e01eee6 100644
--- a/libminifi/include/http/BaseHTTPClient.h
+++ b/libminifi/include/http/BaseHTTPClient.h
@@ -216,9 +216,6 @@ class BaseHTTPClient {
 
   virtual void set_request_method(HttpRequestMethod method) = 0;
 
-  virtual void setPeerVerification(bool peer_verification) = 0;
-  virtual void setHostVerification(bool host_verification) = 0;
-
   virtual void setHTTPProxy(const HTTPProxy &proxy) = 0;
 
   virtual void setBasicAuth(const std::string& username, const std::string& password) = 0;
diff --git a/libminifi/include/http/HTTPClient.h b/libminifi/include/http/HTTPClient.h
index 97df8c57c..d34e499fe 100644
--- a/libminifi/include/http/HTTPClient.h
+++ b/libminifi/include/http/HTTPClient.h
@@ -122,9 +122,6 @@ class HTTPClient : public BaseHTTPClient, public core::Connectable {
 
   void set_request_method(http::HttpRequestMethod method) override;
 
-  void setPeerVerification(bool peer_verification) override;
-  void setHostVerification(bool host_verification) override;
-
   void setBasicAuth(const std::string& username, const std::string& password) override;
   void clearBasicAuth() override;
 
diff --git a/libminifi/src/http/HTTPClient.cpp b/libminifi/src/http/HTTPClient.cpp
index df478a3eb..cb5baa2fe 100644
--- a/libminifi/src/http/HTTPClient.cpp
+++ b/libminifi/src/http/HTTPClient.cpp
@@ -121,21 +121,6 @@ void HTTPClient::initialize(http::HttpRequestMethod method, std::string url, std
   if (isSecure(url_))
     configure_secure_connection();
 }
-
-void HTTPClient::setPeerVerification(bool peer_verification) {
-  if (peer_verification) {
-    logger_->log_debug("Enabling peer verification");
-  } else {
-    logger_->log_warn("Disabling peer verification: the authenticity of https servers will not be verified!");
-  }
-  curl_easy_setopt(http_session_.get(), CURLOPT_SSL_VERIFYPEER, peer_verification);
-}
-
-void HTTPClient::setHostVerification(bool host_verification) {
-  logger_->log_debug("{} host verification", host_verification ? "Enabling" : "Disabling");
-  curl_easy_setopt(http_session_.get(), CURLOPT_SSL_VERIFYHOST, host_verification);
-}
-
 void HTTPClient::setBasicAuth(const std::string& username, const std::string& password) {
   curl_easy_setopt(http_session_.get(), CURLOPT_USERNAME, username.c_str());
   curl_easy_setopt(http_session_.get(), CURLOPT_PASSWORD, password.c_str());