水豚 +牛排 + SSL协议
我使用 Steak + Capybara 进行验收测试,并使用rack-ssl 进行 SSL 强制执行,现在,当我尝试运行测试套件时,我收到错误消息
(错误代码:ssl_error_rx_record_too_long)
知道如何使其工作吗?
I'm using Steak + Capybara for acceptance testing and rack-ssl for SSL enforcement, now, when I tried to run the test suite, I've got the error message
(Error code: ssl_error_rx_record_too_long)
Any idea how to make it work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Capybara 推出了普通应用程序服务器 (Mongrel/Webrick),它不支持 SSL。要在本地计算机上获得 SSL 环境,您必须使用 mod_ssl 和 mod_proxy 设置 nginx 或 Apache 之类的东西,以接受 SSL 连接并将纯 HTTP 请求代理到您的开发服务器。
然后,您可以在测试环境设置中启动它,并在测试中导航到此 SSL 服务器而不是应用程序服务器本身。
注意事项:
要设置“ssl 服务器”,您必须创建一个自签名 SSL 证书。默认情况下,浏览器不信任它,直到您将其添加到例外列表中。 AFAIR Capybara selenium 驱动程序每次都会创建一个新的 Firefox 配置文件,因此它会拒绝您的 SSL 证书。您可能必须购买“真实”证书。
Capybara 在随机可用端口上启动其内部服务器,您需要更改它。我记得我写过一些类似的话:
Capybara launches plain app server (Mongrel/Webrick), which doesn't support SSL. To get SSL environment on your local machine you'd have to setup something like nginx or Apache with mod_ssl and mod_proxy to accept SSL connections and proxy plain HTTP requests to your devel server.
You can then launch it in your test environment setup, and in your tests to navigate to this SSL server rather than app server itself.
Caveats:
To set up "ssl server" you will have to create a self-signed SSL certificate. A browser does not trust it by default until you add it to the list of exceptions. AFAIR Capybara selenium driver creates a new Firefox profile each time, so it will reject your SSL cert. You might have to purchase a "real" certificate.
Capybara launches its internal server on random available port, you will need to change it. I recall writing something along the lines of: