简体   繁体   English

Android模拟器中的代理和SSL连接

[英]Proxy and SSL connections in android emulator

Would anyone know how to configure the emulator to make ssl connections via a proxy ? 有谁知道如何配置模拟器以通过代理建立ssl连接?

I use the -http-proxy option when starting the emulator. 启动模拟器时,我使用-http-proxy选项。 I can access any website except those with https protocol. 我可以访问除具有https协议的网站以外的任何网站。

Any idea ? 任何想法 ?

I've experienced similar problems with Android during a web project lately. 最近在一个Web项目中,Android遇到了类似的问题。 The site works fine using ordinary HTTP from Android but when using HTTPS it works now and then. 该网站可以使用Android上的普通HTTP正常运行,但是当使用HTTPS时,它有时会运行。 Some requests just fail and we get "Web page not found"-errors. 某些请求只是失败,我们收到“找不到网页”错误。 The connections are sometimes very slow. 连接有时非常慢。 After some further tests and investigation I found out that the problem was general for all HTTPS sites, not only for our site. 经过一些进一步的测试和调查,我发现问题出在所有HTTPS站点,而不仅仅是我们站点。

According to a bug report for Android others are reporting the same problem and Android has been hit by it since version 1.5: http://code.google.com/p/android/issues/detail?id=3334 根据Android的错误报告,其他人也报告了相同的问题,并且从1.5版开始,Android就遭到了该问题的攻击: http : //code.google.com/p/android/issues/detail?id=3334

I removed the APN proxy in my HTC Desire, as stated in the bug report above, and then Android performed as expected on HTTPS sites. 如上面的错误报告所述,我在HTC Desire中删除了APN代理,然后Android在HTTPS网站上按预期执行了操作。 For our purpose we have made an exception for Android telephone so they are routed to the ordinary HTTP site instead. 为了我们的目的,我们将Android电话作为例外,因此将它们路由到普通的HTTP站点。

In other words, it seems like Android has a general problem with proxies and that may be the cause of problem with the emulator. 换句话说,Android似乎在代理方面存在一个普遍的问题,这可能是模拟器出现问题的原因。 Vote on the bug, just follow the link above. 对错误进行投票,只需点击上面的链接。

There are several possible reasons for that: 有以下几种可能的原因:

  • Can you access the HTTPS site with your real phone? 您可以使用真实电话访问HTTPS网站吗? If not, then probably the involved certificate is not considered as trusted from the app/webview. 如果不是,则可能不认为所涉及的证书是来自应用程序/网络视图的受信任证书。 If you need to consider a certificate as trusted within your app, look at the following tutorial 如果您需要将证书视为应用程序中的受信任证书,请查看以下教程
  • Can you access HTTPS sites at all via your proxy from a webbrowser? 您是否可以通过Web浏览器通过代理完全访问HTTPS网站? Our enterprise proxy server does not allow HTTPS traffic (for whatever reason) at all. 我们的企业代理服务器完全不允许HTTPS通信(无论出于何种原因)。 You could also sniff the traffic with Wireshark etc. to see if anything is sent back from the proxy or an error occurred. 您也可以使用Wireshark等嗅探流量,以查看是否有任何内容从代理发送回或发生错误。

What type of problem did you get when you try to connect to the website? 当您尝试连接到网站时遇到什么类型的问题? Can you provide a stacktrace or LogCat output? 您可以提供stacktrace或LogCat输出吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM