check (Rack::Auth::OpenID)

    # File lib/rack/auth/openid.rb, line 250
          def check(consumer, session, req)
            session[:openid_param]  = req.params[@options[:openid_param]]
            oid = consumer.begin(session[:openid_param], @options[:anonymous])
            pp oid if $DEBUG
            req.env['rack.auth.openid.request'] = oid

            session[:site_return] ||= req.env['HTTP_REFERER']

            # SETUP_NEEDED check!
            # see OpenID::Consumer::CheckIDRequest docs
            query_args = [@realm, *@options.values_at(:return_to, :immediate)]
            query_args[1] ||= req.url
            query_args[2] = false if session.key? :setup_needed
            pp query_args if $DEBUG

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

            if oid.send_redirect?(*query_args)
              redirect = oid.redirect_url(*query_args)
              if $DEBUG
                pp redirect
                pp Rack::Utils.parse_query(URI(redirect).query)
              end
              [ 303, {'Location'=>redirect}, [] ]
            else
              # check on 'action' option.
              formbody = oid.form_markup(*query_args)
              if $DEBUG
                pp formbody
              end
              body = HTML % ['Confirm...', formbody]
              [ 200, {'Content-Type'=>'text/html'}, body.to_a ]
            end
          rescue ::OpenID::DiscoveryFailure => e
            # thrown from inside OpenID::Consumer#begin by yadis stuff
            req.env['rack.errors'].puts($!.message, *$@)

            @options. ### Foreign server failed
              fetch :auth_fail, [ 503,
                {'Content-Type'=>'text/plain'},
                'Foreign server failure.' ]
          end