module Puma::RackHandler

def set_host_port_to_config(host, port, config)

def set_host_port_to_config(host, port, config)
  config.clear_binds! if host || port
  if host && (host[0,1] == '.' || host[0,1] == '/')
    config.bind "unix://#{host}"
  elsif host && host =~ /^ssl:\/\//
    uri = URI.parse(host)
    uri.port ||= port || ::Puma::Configuration::DEFAULTS[:tcp_port]
    config.bind uri.to_s
  else
    if host
      port ||= ::Puma::Configuration::DEFAULTS[:tcp_port]
    end
    if port
      host ||= ::Puma::Configuration::DEFAULTS[:tcp_host]
      config.port port, host
    end
  end
end