With Android KitKat chrome://inspect/devices netwo

2019-05-07 05:20发布

问题:

I am using the "chrome://inspect/devices" and monitoring the http traffic for an Android application. This only works with the Android 4.4/KitKat. Within this tool, the set-cookie and cookie data does not show. Is there another tool or how can I configure this tool to show the cookie data for each request. The "cookie" store set of cookies do appear but not for each individual request between the server and client/Android device.

I believe this hybrid Cordova based web view is masking the cookies. I don't know how.

More information: http://code.google.com/p/chromium/issues/detail?id=403490

Note: this is monitoring traffic between the Android device and a host PC, monitoring the traffic on the host PC.

Note: It looks like it is a "webview" or application/api/library issue. We are using Cordova to build this application. It is a hybrid/web-view application, I don't know why or how it could explicitly hide the cookie information? I was curious if anyone has any more detail on how a webview could hide cookies.

回答1:

Since you mention

Is there another tool

I am going to jump at this part and offer you a different tool, i.e. Fiddler.

  1. You can set up Fiddler with proxy
  2. Change the Android device network settings to go through the proxy.
  3. Now, you can capture complete network requests inclusive of any request made from the device.

So perfect for development, if I may say so.

Source - http://www.cantoni.org/2013/11/06/capture-android-web-traffic-fiddler

Helps to ease a painful debugging experience, to a pleasant one.

Some freebies

  1. Fiddler also allows to break on http requests, modify the content, reissue requests without having to write any piece of code.
  2. And another factor, it works for any Android release, iOS or Windows Phone or any device that supports proxy.
  3. No SDKs required to do this!

If you are using a mac, you can checkout Charles network inspector.

Hope this helps!

Note - This answer is purely to help in inspecting the network traffic.

Update - HTTPS traffic

Install Fiddler Certificate to Android

As a final step to improve the debugging of secure HTTPS connections, we can install a Fiddler “root” certificate on the Android device. (Note: If your device does not already have a PIN or password, you will need to set one up before installing the certificate.)

Steps:

  1. On Android start the Chrome browser

  2. Navigate to http://ipv4.fiddler:8888/

  3. Tap on the link for the “Fiddler Root Certificate”

  4. Name the certificate “Fiddler” and install it (entering your PIN or password if prompted)

With this test certificate installed, you should now be able to visit SSL sites from the Android Chrome browser and not receive any certificate warnings. The network traffic should also be viewable in Fiddler. Good test sites are those which always force secure HTTPS connections, like the Wells Fargo mobile site at https://wellsfargo.com/.

Exercpt from the posted link.



回答2:

Have a look at the WebViews CookieManager. Specifically look at the 'allowFileSchemeCookies' and 'setAcceptFileSchemeCookies' methods. If they are false by default that may be the culprit.