
[英]Errno::ECONNREFUSED (Failed to open TCP connection to :80 - Authenticated requests fails
[英]Errno::ECONNREFUSED (Failed to open TCP connection to :80 (Connection refused - connect(2) for nil port 80))
我正在尝试使用库HTTParty
,但每当我运行下面的代码时,我都会收到错误。
码:
require 'httparty'
response = HTTParty.get('http://example.com')
当我运行代码时,我收到错误: Errno::ECONNREFUSED (Failed to open TCP connection to :80 (Connection refused - connect(2) for nil port 80))
。 当我在net/http
运行相同的代码时,我没有收到任何错误。 我不知道这是否有帮助,但我运行的系统是Linux Mint 18.3 Cinnamon 64-bit。
我知道这已经很晚了,但使用https://example.com
而不是http://example.com
是我的问题的解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.