libcpr / cpr

C++ Requests: Curl for People, a spiritual port of Python Requests.
https://docs.libcpr.org/
Other
6.49k stars 924 forks source link

http proxy fail to work #900

Closed khtkiprw closed 1 year ago

khtkiprw commented 1 year ago

Description

With http proxies, authentication is always required image

Is this header correct? image

Example/How to Reproduce

cpr::Session session;
session.SetProxies({ {"http","http://44.199.26.89:31112"},{"https","http://44.199.26.89:31112"} });
session.SetProxyAuth(cpr::ProxyAuthentication({{"http",cpr::EncodedAuthentication("khXXX","PtsIjHXXX")},{"https",cpr::EncodedAuthentication("khtXXX","PtsIjHBYXXX")}}));
session.SetUrl("https://www.taobao.com/help/getip.php");
cpr::Response resp = session.Get();
std::cout << resp.text;

Possible Fix

No response

Where did you get it from?

vcpkg

Additional Context/Your Environment

COM8 commented 1 year ago

Hi @khtkiprw thanks for opening this issue!

Let me summarize your question to make sure I understand it correctly:

Correct?

khtkiprw commented 1 year ago

proxy authentication I'm sure it's correct Since I use the Socks5 proxy, it works fine, but trying to use the http proxy results in an error, always returning 407

image

There is also a response header, which should be a combination of a connection proxy response header and a data request response header

COM8 commented 1 year ago

Hmmm 407 indicates an authentication issue. We had an other report about this here with a fix for it that is going to be released in 1.11.0 since it introduces breaking changes. Any chance you can try with a current master build?

khtkiprw commented 1 year ago

http proxy worked from master build. Thank you very much

COM8 commented 1 year ago

Awesome!