Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ssl 通过Charles代理casperjs/phantomjs_Ssl_Proxy_Phantomjs_Casperjs_Charles Proxy - Fatal编程技术网

Ssl 通过Charles代理casperjs/phantomjs

Ssl 通过Charles代理casperjs/phantomjs,ssl,proxy,phantomjs,casperjs,charles-proxy,Ssl,Proxy,Phantomjs,Casperjs,Charles Proxy,我想使用casperjs/phantomjs自动填充一些web表单。为了调试我的casperjs脚本,我想使用(很棒的)中间人SSL代理,但还没有弄清楚如何在casperjs/phantomjs中实现这一点 什么有效 我已经允许Charles在Firefox和远程服务器之间进行代理。浏览器和远程服务器都接受SSL证书,Charles正确解码HTTPS数据包,因此我可以看到浏览器和远程服务器之间的通信量。到目前为止还不错 我还能够在没有Charles代理的情况下运行casperjs脚本,并验证脚本

我想使用casperjs/phantomjs自动填充一些web表单。为了调试我的casperjs脚本,我想使用(很棒的)中间人SSL代理,但还没有弄清楚如何在casperjs/phantomjs中实现这一点

什么有效 我已经允许Charles在Firefox和远程服务器之间进行代理。浏览器和远程服务器都接受SSL证书,Charles正确解码HTTPS数据包,因此我可以看到浏览器和远程服务器之间的通信量。到目前为止还不错

我还能够在没有Charles代理的情况下运行casperjs脚本,并验证脚本是否正确地将我登录到远程站点,如中所示:

$ casperjs test-login.js
found login form...
logged in...
也很好

什么不起作用 当我试图通过Charles将phantomjs定向到代理时,如:

$ casperjs --web-security=no --proxy=127.0.0.1:8888 test-login.js
。。。casperjs甚至没有收到登录页面,Charles控制台中会显示以下内容:

URL     https://www.<my server>.com
Status  Failed
Failure No request was made. Possibly the SSL certificate was rejected.
Notes   You may need to configure your browser or application to trust the Charles Root Certificate. See SSL Proxying in the Help menu.
。。。查尔斯是V3.10.1

(如果回答自己的问题是一项奥林匹克运动,那么我就是在争夺金牌。)

添加
--ignore ssl errors=true
对于使事情正常运行是必要的,并且已经足够了--通过它,您可以看到通过Charles的所有流量:

$ casperjs --ignore-ssl-errors=true --proxy=127.0.0.1:8888 test-login.js
found login form...
logged in...
笔记
给智者的话:如果交换看起来进展非常缓慢,请确保您没有在Charles中意外打开节流。去过那里!:)

非常缓慢的网络性能是PhantomJS 1.9的已知问题之一:建议完全禁用代理,在您的情况下,这显然是无法做到的。实际上,可能是我在Charles中意外打开了节流。我会重新运行--这可能不是问题。
$ casperjs --ignore-ssl-errors=true --proxy=127.0.0.1:8888 test-login.js
found login form...
logged in...