【发布时间】:2015-01-26 15:04:03
【问题描述】:
我正在尝试将我的 ruby 中的 shell curl 替换为更原生的东西,例如“open-uri”,但失败并得到:“需要 401 授权”
我正在尝试替换这个:
status = system("curl -Is -w '%{http_code}\\n' --digest -u #{usr}:#{psw} https://#{source}/ -o /dev/null")
有了这个:
require 'open-uri'
status = open("https://#{source}/", :http_basic_authentication=>[usr, psw])
但仍然收到 401。知道吗? 谢谢
【问题讨论】:
标签: ruby bash shell curl open-uri