我正在编写一个针对RESTful api的phonegap应用程序.出于调试的目的,我想看看我的POST和GET是什么样的.谷歌上的所有信息都说使用了一个提琴手代理.我安装了小提琴并且工作,设置我的android模拟器使用它,但每当我开始查询restful服务时,数据包会以某种方式被破坏(或者至少是它的授权部分).
如果我没有代理,下面的JS代码在我的android模拟器中工作正常:
$.post("https://blah.hi.com/homepage/security_check",
$("#loginForm").serialize(), function (data, textStatus, jqXHR) {...
但是,当我有提琴手去,以便我可以分析我的Android应用程序正在进行的请求时,我收到以下错误:
据我所知,在检查fiddler中的初始请求时,会进行以下更改:
剥离用户代理,连接和主机标头.我尝试使用Fiddler规则手动添加它们,但这没有用.
这是一个很好的比较:
此外,当我查看请求的TextView选项卡时,Extensions下的以下标题将被删除(以下是使用Chrome时请求的内容以及通过fiddler,并且有效的图片):
现在通过fiddler浏览eclipse安卓模拟器时失败了:
我想过使用WireShark,但所有的通信都是通过https完成的,并且更喜欢使用fiddler.
任何建议将不胜感激!!另外,我从http://vkosinets.com/blog/2011/08/16/debug-http-requests-from-android-emulator开始使用以下参数-http-proxy 127.0.0.1:8888来访问代理
编辑:这是使用Android 4.X仿真器时的一些调试信息(也失败).
解决方法:
针对旧的Android SDK / Emulator版本报告的问题很可能是:
Issue 12356: lost header on https connection via proxy
另外值得查看相关问题中缺少的标题讨论:
Issue 3334: SSL web sites fail to load in browser application when not connected via Wi-Fi
根据this post,似乎这个问题仅存在于Android 3.x及更低版本中:
this problem is ONLY occuring on Android 3.x and lower versions. iOS is fine. All major desktop browsers are fine. Android 4.x is fine.
尝试使用Android 4.x模拟器,看看是否有效.
更新:
除了在某些情况下不明确的错误之外,它可能是一个具有挑战性的配置.查看Setting up a persistent trusted CA in an Android emulator:
Setting up a persistent trusted CA in the Android emulator is a common problem, encountered any time we assess an application within an emulator, that use SSL properly. The goal is to man-in-the-middle (MITM) traffic from an application running in the Android emulator.
In order to successfully MITM traffic, the Certificate Authority (CA) of the middle node must be trusted by the device, otherwise the connection will fail with some generic SSL Handshake error. Typically, the middle node can be flagged as trusted on a rooted phone by modifying the cacerts file, and rebooting the device. When attempting to do this in the Android emulator, rebooting the virtual device causes the OS to revert many system files back to their base state – including the cacerts file. The rest of this post describes how to set up an emulator that will retain modifications to the core system files after reboots. This has not been documented in one place (to my knowledge), so hopefully this will save time for those facing this problem.
… …
原文地址:https://codeday.me/bug/20190709/1411431.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。