# File lib/openid/server.rb, line 1458
      def which_encoding
        if has_return_to()
          if @openid_message.is_openid2 and
              encode_to_url().length > OPENID1_URL_LIMIT
            return ENCODE_HTML_FORM
          else
            return ENCODE_URL
          end
        end

        if @openid_message.nil?
          return nil
        end

        mode = @openid_message.get_arg(OPENID_NS, 'mode')
        if mode
          if !BROWSER_REQUEST_MODES.member?(mode)
            return ENCODE_KVFORM
          end
        end

        # If your request was so broken that you didn't manage to
        # include an openid.mode, I'm not going to worry too much
        # about returning you something you can't parse.
        return nil
      end