Skip to content

Debugging Https bugs using Charles

Vincent Dondain edited this page Nov 17, 2016 · 3 revisions

Charles is a web debugging proxy that allows to sniff the http communications with a remote server. Charles is a good tool to use to be able to debug possible issues with the network stack, specially the HttpClient and one of its implementations.

This document shows the few steps that have to be taken to be able to use Charles for debugging https calls.

Getting Started

Download Charles

You can start using Charles with its trial license which will provide you with a copy of the application that limits the amount of time the application will run. Of course, if you do find the software we recommend you to get a license ;)

The application downloads can be found here.

Installing the ssl proxy

Once the application has been installed, it is important to install the Charles CA SSL certificate in the iOS Simulators in order to be able to use see the encrypted communication.

As of version 3.9.3, Charles contains a menu item that allows the installation of the certificate in all the simulators present in your system. This menu item can be found in the Help menu under "Install Charles CA SSL Certificate in iOS Simulators" which will do the installation for you.

Development details

HttpClient

There are several implementations of the HttpClient, each of them might need to be set to use the system proxy in order to be able to sniff the communication.

  • Managed: Nothing needs to be done.
  • CFNetwork: Make sure that the property UseSystemProxy in the CFNetworkHandler is set to be true.
  • NSUrlSession: Nothing needs to be done.
Clone this wiki locally