Android CONNECT tunnel emulator skips expected headers

I am writing a phonegap application that works against a RESTful api. For debugging purposes, I would like to see what my POST and GET look like. All google information says to use the Fiddler proxy. I installed the script and it works, I configured the emulator of my Android to use it, but whenever I start to request a sedative service, the packages are somehow distorted (or at least part of it).

If I do not have a proxy server, the following JS code works fine in my Android emulator:

$.post("https://blah.hi.com/homepage/security_check", $("#loginForm").serialize(), function (data, textStatus, jqXHR) {... 

But when I get a violinist, so that I can analyze the requests that the Android application makes, I get the following error:

enter image description here

As far as I can tell by checking the initial request in the violinist, the following changes have been made:

The User-Agent, Connection, and Host headers are deleted. I tried adding them manually using the Fiddler rules, but this did not work.

Here is a good comparison:

enter image description here

In addition, when I look at the TextView tab of the request, the following headers in the "Extensions" section are deleted (the following image is an image of how the request looks when using Chrome, and it works through the violinist):

enter image description here

Now, when it passes through the android eclipse emulator, through the violinist and does not work: enter image description here

I thought about using WireShark, but all messages are executed via https and prefer to use a script.

Any advice would be greatly appreciated !! Also, I get a proxy server using the following argument -http-proxy 127.0.0.1:8888 from here http://vkosinets.com/blog/2011/08/16/debug-http-requests-from-android-emulator

EDIT: Here are some debugging data when using the Android 4.X emulator (which also fails). enter image description here

+4
source share
1 answer

The problem is probably related to the old version of Android SDK / Emulator:

Problem 12356: a lost header when connecting https through a proxy

It's also worth checking out the missing title discussion in a related issue:

Issue 3334: SSL websites do not load in the browser application if they are not connected via Wi-Fi

According to this post , it seems that this problem only exists on Android 3.x and lower versions:

this problem ONLY occurs on Android 3.x and lower versions. iOS is fine. All major desktop browsers are in order. Android 4.x is fine.

Try using the Android 4.x emulator and see if this works.

Update:

This is probably a complex configuration, different from a fuzzy error in some situation. Check Configuring a Permanent Trusted CA in the Android Emulator :

Setting up a permanent trusted CA in the Android emulator is a common problem that occurs at any time when we evaluate an application in an emulator that uses SSL correctly. The goal is to allow man-in-the-middle (MITM) traffic from an application running in the Android emulator.

In order for MITM traffic to succeed, the trustee of the middle node certification authority (CA) must be trusted by the device, otherwise the connection will end with some common SSL confirmation error. the middle node can be marked as trusted on the root phone by modifying the cacerts file and rebooting the device. When you try to do this in the Android emulator, rebooting the virtual device causes the OS to return many system files back to their base state, including the cacerts file. The rest of this post describes how to configure an emulator that saves changes to the main system files after a reboot. This has not been documented in one place (as far as I know), so hopefully this will save time for those who are faced with this problem.

......

+1
source

All Articles