Ravil - Thank you very much!
Working example Ruby CGI Basic Authorization

---------------------------------------
Add this in you .htaccess
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_CGI_AUTHORIZATION:%1]
---------------------------------------
#!c:/ruby/bin/ruby.exe

$kcode = "windows-1251"

require 'cgi'

cgi = CGI.new 'html4'
auth_type, credentials = ENV['HTTP_CGI_AUTHORIZATION'].split(' ')

if auth_type == 'Basic' && (user, pass = 
credentials.unpack('m*').first.split(':', 2)) && user == 'test' && pass 
= 'test'
  cgi.out {
    cgi.html {
      cgi.body {
        cgi.h2 { "Login: #{user}" } +
        cgi.h2 { "Pass:  #{pass}" }
      }
    }
  }
else
  cgi.out("Status" => "401 Authorization Required", "Type" => 
"text/html", "WWW-Authenticate" => 'Basic realm="Web Password"') do
    "401 Authorization Required"
  end
end

-- 
Posted via http://www.ruby-forum.com/.