module ActionDispatch::Http::URL

def normalize_protocol(protocol)

def normalize_protocol(protocol)
  case protocol
  when nil
    secure_protocol ? "https://" : "http://"
  when false, "//"
    "//"
  when PROTOCOL_REGEXP
    "#{$1}://"
  else
    raise ArgumentError, "Invalid :protocol option: #{protocol.inspect}"
  end
end