I've been trying, without success, to include a basic HTTP
authentication header in my download() calls (to my Rails server).
This is what the code looks like:

              headers = {}
              headers['Authorization'] = 'Basic ' +
Base64.encode64("[EMAIL PROTECTED]()}:[EMAIL PROTECTED]()}").chop
              # run the download
              download "#{$SITE_URL}/badaboo/new.xml", :method =>
"POST", :headers => headers do |result|
                # if it passes then goto the next screen.
                @status.text = "The result is #{result.response.body}"
              end


Its not working... authentication is not happening, and from what I
can tell, the built-in Rails 2.0 block is not being called:

        authenticate_or_request_with_http_basic do |user_name, password|
          # this block never gets called.
        end

Has anyone tried to do this? I'm using Mongrel (without Apache) in a
development environment (which should theoretically work fine). I'm
wondering if the download() call does things to the header ... maybe I
should fall back to OpenURI ...

Etienne

Reply via email to