IIS, Net::HTTP::Get, and Basic Authentication


#1

I’m getting a 401.2 from IIS
You do not have permission to view this directory or page using the
credentials that you supplied because your Web browser is sending a
WWW-Authenticate header field that the Web server is not configured to
accept.
The sysadmin says that basic auth is enabled. Is there something
special about how rails handles basic auth? Is there a way for me to
see what the server actually gets and what the headers say is
acceptable?

My Code:
def get_wsdl(url=nil)
return false if url.nil?
url = URI.parse(url) unless url.is_a?(URI)

connection = Net::HTTP.new(url.host, url.port)
connection.use_ssl = true
connection.verify_mode = OpenSSL::SSL::VERIFY_NONE

connection.start do |http|
  req = Net::HTTP::Get.new("#{url.path}?#{url.query}")
  req.basic_auth 'username','password'
  puts http.request(req).body
end

end