check (Rack::Auth::OpenID)

    # File lib/rack/auth/openid.rb, line 249
          def check(consumer, session, req)
            oid = consumer.begin(req.GET[@openid_param], @anonymous)
            req.env['rack.auth.openid.request'] = oid
            req.env['rack.errors'].puts(oid.message)
            p oid if $DEBUG

            ## Extension support
            extensions.each do |ext,args|
              oid.add_extension(ext::Request.new(*args))
            end

            session[:openid_param] = req.GET[openid_param]
            return_to_uri = return_to ? return_to : req.url
            session[:return_to] = return_to_uri
            immediate = session.key?(:setup_needed) ? false : immediate

            if oid.send_redirect?(realm, return_to_uri, immediate)
              uri = oid.redirect_url(realm, return_to_uri, immediate)
              redirect(uri)
            else
              confirm_post_params(oid, realm, return_to_uri, immediate)
            end
          rescue ::OpenID::DiscoveryFailure => e
            # thrown from inside OpenID::Consumer#begin by yadis stuff
            req.env['rack.errors'].puts([e.message, *e.backtrace]*"\n")
            return foreign_server_failure
          end