microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.97k stars 1.65k forks source link

No User-Agent Header in Proxy CONNECT requests through WinHTTP #512

Open reneme opened 7 years ago

reneme commented 7 years ago

Our environment uses a proxy server for internet access control. Using the contribution in #496 ("Use IE proxy by default") we successfully established SSL connections through a system-wide proxy server. However, we need to support filtering of outgoing connections based on the User-Agent header in HTTP CONNECT requests.

Unfortunately C++ REST SDK does not set the User-Agent header for CONNECT requests. After some digging, it seems that the underlying WinHTTP is the culprit here. That is a very unfortunate show stopper for our application. We already tried to adapt the WinHTTP usage in C++ REST SDK to our needs, but without success.

Is there any magic switch we've been missing in WinHTTP to (re-)enable this behaviour?

deeringc commented 6 years ago

It's not a pretty option, but you could adapt the http_client_asio to windows and set the user agent during the CONNECT there directly. That approach would give you full control.