class Puma::DSL

def self.ssl_bind_str(host, port, opts)

Other tags:
    See: ssl_bind -
def self.ssl_bind_str(host, port, opts)
  verify = opts.fetch(:verify_mode, 'none').to_s
  tls_str =
    if opts[:no_tlsv1_1]  then '&no_tlsv1_1=true'
    elsif opts[:no_tlsv1] then '&no_tlsv1=true'
    else ''
    end
  ca_additions = "&ca=#{Puma::Util.escape(opts[:ca])}" if ['peer', 'force_peer'].include?(verify)
  low_latency_str = opts.key?(:low_latency) ? "&low_latency=#{opts[:low_latency]}" : ''
  backlog_str = opts[:backlog] ? "&backlog=#{Integer(opts[:backlog])}" : ''
  if defined?(JRUBY_VERSION)
    cipher_suites = opts[:ssl_cipher_list] ? "&ssl_cipher_list=#{opts[:ssl_cipher_list]}" : nil # old name
    cipher_suites = "#{cipher_suites}&cipher_suites=#{opts[:cipher_suites]}" if opts[:cipher_suites]
    protocols = opts[:protocols] ? "&protocols=#{opts[:protocols]}" : nil
    keystore_additions = "keystore=#{opts[:keystore]}&keystore-pass=#{opts[:keystore_pass]}"
    keystore_additions = "#{keystore_additions}&keystore-type=#{opts[:keystore_type]}" if opts[:keystore_type]
    if opts[:truststore]
      truststore_additions = "&truststore=#{opts[:truststore]}"
      truststore_additions = "#{truststore_additions}&truststore-pass=#{opts[:truststore_pass]}" if opts[:truststore_pass]
      truststore_additions = "#{truststore_additions}&truststore-type=#{opts[:truststore_type]}" if opts[:truststore_type]
    end
    "ssl://#{host}:#{port}?#{keystore_additions}#{truststore_additions}#{cipher_suites}#{protocols}" \
      "&verify_mode=#{verify}#{tls_str}#{ca_additions}#{backlog_str}"
  else
    ssl_cipher_filter = opts[:ssl_cipher_filter] ? "&ssl_cipher_filter=#{opts[:ssl_cipher_filter]}" : nil
    v_flags = (ary = opts[:verification_flags]) ? "&verification_flags=#{Array(ary).join ','}" : nil
    cert_flags = (cert = opts[:cert]) ? "cert=#{Puma::Util.escape(cert)}" : nil
    key_flags = (key = opts[:key]) ? "&key=#{Puma::Util.escape(key)}" : nil
    password_flags = (password_command = opts[:key_password_command]) ? "&key_password_command=#{Puma::Util.escape(password_command)}" : nil
    reuse_flag =
      if (reuse = opts[:reuse])
        if reuse == true
          '&reuse=dflt'
        elsif reuse.is_a?(Hash) && (reuse.key?(:size) || reuse.key?(:timeout))
          val = +''
          if (size = reuse[:size]) && Integer === size
            val << size.to_s
          end
          if (timeout = reuse[:timeout]) && Integer === timeout
            val << ",#{timeout}"
          end
          if val.empty?
            nil
          else
            "&reuse=#{val}"
          end
        else
          nil
        end
      else
        nil
      end
    "ssl://#{host}:#{port}?#{cert_flags}#{key_flags}#{password_flags}#{ssl_cipher_filter}" \
      "#{reuse_flag}&verify_mode=#{verify}#{tls_str}#{ca_additions}#{v_flags}#{backlog_str}#{low_latency_str}"
  end
end