add_extension (Rack::Auth::OpenID)

    # File lib/rack/auth/openid.rb, line 402
          def add_extension ext, *args
            if not ext.is_a? Module
              raise TypeError, "#{ext.inspect} is not a module"
            elsif !(m = %w'Request Response NS_URI' -
                    ext.constants.map{ |c| c.to_s }).empty?
              raise ArgumentError, "#{ext.inspect} missing #{m*', '}"
            end

            consts = [ext::Request, ext::Response]

            if not consts.all?{|c| c.is_a? Class }
              raise TypeError, "#{ext.inspect}'s Request or Response is not a class"
            elsif not consts.all?{|c| ::OpenID::Extension > c }
              raise ArgumentError, "#{ext.inspect}'s Request or Response not a decendant of OpenID::Extension"
            end

            if not ext::NS_URI.is_a? String
              raise TypeError, "#{ext.inspect}'s NS_URI is not a string"
            elsif not uri = URI(ext::NS_URI)
              raise ArgumentError, "#{ext.inspect}'s NS_URI is not a valid uri"
            elsif not uri.scheme =~ /^https?$/
              raise ArgumentError, "#{ext.inspect}'s NS_URI is not an http uri"
            elsif not uri.absolute?
              raise ArgumentError, "#{ext.inspect}'s NS_URI is not and absolute uri"
            end
            @extensions[ext] = args
            return ext::NS_URI
          end