From: "dsharp2@..." Date: 2001-04-21T21:31:15+09:00 Subject: [ruby-talk:13970] Re: Net::HTTP basic authentication On Friday 20 April 2001 01:55, ts wrote: > >>>>> "d" == dsharp2@nc rr com writes: > > d> enc = "Basic" + encode64( "donald:secret" ) > ^^^^^ > > You have forgotten ' ' after Basic > > enc = "Basic " + encode64( "donald:secret" ) > > > Guy Decoux Tried that as well, didn't work: #!/usr/local/bin/ruby require 'net/http' require 'base64' h = Net::HTTP.new('192.168.1.1',80) enc = "Basic " + encode64( "fooey:secret" ); resp, data = h.get( '/index.html' , 'Authorization' => enc ); puts "Code = #{resp.code}" puts "Message = #{resp.message}" resp.each { |key, val| printf "%s = %s\n", key, val } puts data returns: [sharpd@localhost link]$ ./link.rb Code = 401 Message = Authorization Required content-type = image/gif www-authenticate = Basic realm="Linksys BEFSR41/BEFSR11/BEFSRU31" expires = Thu, 13 Dec 1969 10:29:00 GMT pragma = no-cache nil Does anyone have some pointers that would explain how this all works? Thanks! donald