Hi everyone.
I’m quite new to Ruby and I’m not exactly familiar with the mailing
lists and everything so scream if I’m abusing the list.
I have a problem with Net::HTTP and it’s use of headers (well, it might
be that the problem is in protocol.rb or that the problem is just me and
my grasp of programming, we’ll see).
The problem:
I want to access a site (which is provided by the firmware on my DSL
router) that requires basic authentication.
The environment:
ruby 1.6.8-8 on W2K
I use the following code
http_connection = Net::HTTP.new(‘target’).start()
headers ={}
headers[‘Authorization’] = 'Basic '+ [“id:pass”].pack(‘m’).strip
begin
resp, data = http_connection.get("/", headers)
#rescue
end
and I get the following errors
f:/devlab/ruby/lib/ruby/1.6/net/protocol.rb:221:in error!': 401 "Authorization Required" (Net::ProtoFatalError) from f:/devlab/ruby/lib/ruby/1.6/net/http.rb:1217:in
value’
from f:/devlab/ruby/lib/ruby/1.6/net/http.rb:605:in `get’
Snooping on my network traffic I see the headers in a Continuation
message so I am sending them, just not correctly :).
Shouldn’t a 401 response produce a Net::ProtoRetriableError ?
Can anybody help me get past this?
Thanks,
V.-
···
–
http://www.freemail.gr - äùñåÜí õðçñåóßá çëåêôñïíéêïý ôá÷õäñïìåßïõ.