0

I'm trying to use WinHTTP with Charles proxy. When I use the WINHTTP_ACCESS_TYPE_NAMED_PROXY option and URL to Charles, it logs the the traffic going through it. When I'm using the WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, the connection works, but is not logged by Charles - it is bypassed.

Question is what am I doing wrong?

Initially Charles configured Edge's proxy setting to Manual with it's address. I've changed it to auto, to no avail.

The call I use is

HINTERNET session = WinHttpOpen(nullptr, WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, WINHTTP_FLAG_ASYNC);

session gets a valid value.

I expect the traffic to go through Charles proxy, and be logged by it.


Answer found: Charles settings were made per user, and the code executed in system user process. Making the settings per machine solved the problem.

Thanks for all who have answered, my bad on missing the point.

Uri Raz
  • 435
  • 1
  • 3
  • 15

1 Answers1

1

Once you use WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, the program will decide which agent to use based on the system and the settings of each user. So, the correct Charles proxy URL may not be configured in your proxy settings.

You should specify Charles’s proxy URL before using WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY.

  1. Click on the start menu.
  2. Select settings->Network & Internet->Proxy.
  3. Fill the proxy address in manual proxy settings .
Drake Wu
  • 6,927
  • 1
  • 7
  • 30
  • Thank you for the reply. Charles has automatically filled in the manual proxy setting, setting the 'Use proxy server' to on, and the address to http=127.0.0.1:8888;https=127.0.0.1:8888 Still, Charles doesn't log traffic from my app when I use WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY – Uri Raz Apr 28 '19 at 06:56