Is there a way to use an http proxy for google-cloud-cpp?

杀马特。学长 韩版系。学妹 提交于 2020-05-17 06:01:40

问题


I am using google-cloud-cpp (C++ API for Google Cloud Platform functions) to create/read/write to buckets. When I am working from within the organization's firewall, I have to use a proxy to be able to connect to google cloud. I see that we can configure a proxy using the gcloud command line: gcloud config set proxy/type http gcloud config set proxy/address x.x.x.x gcloud config set proxy/port

Can I do something similar when I use google-cloud-cpp?


回答1:


If we look at the source code of the google-cloud-cpp library as found on GitHub, we seem to see that it is based on libcurl.

See: https://github.com/googleapis/google-cloud-cpp/blob/master/google/cloud/storage/internal/curl_handle.cc

Following on from the comments by @Travis Webb, we then look at the docs for libcurl and find:

https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html

This documents API that can be used to set proxy settings for programs that use libcurl. However, if we read deeper, we find a section on environment variables that declares that http_proxy and https_proxy can be set.



来源:https://stackoverflow.com/questions/58530120/is-there-a-way-to-use-an-http-proxy-for-google-cloud-cpp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!