Function SetProxy

Synopsis

#include <include/restclient-cpp/connection.h>

void SetProxy(const std::string &uriProxy)

Description

set CURLOPT_PROXY

set HTTP proxy address and port

Parameters

proxy - address with port number

Mentioned in

Source

Lines 311-323 in source/connection.cc. Line 203 in include/restclient-cpp/connection.h.

void
RestClient::Connection::SetProxy(const std::string& uriProxy) {
  std::string uriProxyUpper = uriProxy;
  // check if the provided address is prefixed with "http"
  std::transform(uriProxyUpper.begin(), uriProxyUpper.end(),
    uriProxyUpper.begin(), ::toupper);

  if ((uriProxy.length() > 0) && (uriProxyUpper.compare(0, 4, "HTTP") != 0)) {
    this->uriProxy = "http://" + uriProxy;
  } else {
    this->uriProxy = uriProxy;
  }
}





Add Discussion as Guest

Log in