【问题标题】:How to assign port for HTTPI?如何为 HTTPI 分配端口? 【发布时间】:2013-01-28 17:04:59 【问题描述】: 我正在使用httpi 库。 通常在http库中我们可以设置http连接的端口,但在httpi中我不能。 如何为 HTTPI 连接分配端口? 【问题讨论】: 标签: ruby http httpi 【解决方案1】: 通常您会在 URL 中包含端口号,如下所示: request = HTTPI::Request.new("http://example.com:1234/") 【讨论】: 不幸的是,我遇到了一个错误:“ArgumentError: Invalid URL: localhost:17172”