0
간단하게 보이지만 명확하게 보이지는 않습니다 - NTLM으로 인증하십시오.ruby httpclient & NTLM
문서 (http://www.rubydoc.info/gems/httpclient/2.1.5.2/HTTPClient)의 예는 간단 보이지만, 내가 그것을하려고 할 때 난 항상 NTLM이 필요 whch IIS에서 간단한 웹 사이트를 만든 401
를 얻을. 나는 IE & 크롬에서이 작품을 테스트했다.
그때 나의 이해에서
require 'httpclient'
require 'pp'
require 'kconv' #seemed to be needed due to a bug..
require 'rubyntlm' # probably not needed directly?
domain = 'http://qvcluster1/'
url = 'http://qvcluster1/default.htm'
user = 'testuser'
password = 'testpassword'
client = HTTPClient.new
client.set_auth(nil ,user,password)
r = client.get("http://qvcluster1/default.htm")
pp r
그것에별로 더 많은 것이, 아직이 내가 마지막 줄에서 무엇을 얻을의 꼬리 끝
을 실패 :
@reason_phrase="Unauthorized",
@request_absolute_uri=nil,
@request_method="GET",
@request_query=nil,
@request_uri=#<URI::HTTP http://qvcluster1/default.htm>,
@status_code=401>,
모든 의견을 환영합니다!
여담으로, 난 그냥 컬에서 시험이 잘 작동합니다 :
"C:\Program Files\cURL\bin\curl.exe" --ntlm -u testuser:testpassword http://qvcluster1/default.htm
NB : rubyntlm과 함께 작동하는 원시 예제를 얻었으므로 코드 또는 HTTPClient에서 분명히 문제가됩니다. –