class ActionDispatch::SSL

def flag_cookies_as_secure!(headers)

def flag_cookies_as_secure!(headers)
  if cookies = headers["Set-Cookie"]
    cookies = cookies.split("\n")
    headers["Set-Cookie"] = cookies.map { |cookie|
      if !/;\s*secure\s*(;|$)/i.match?(cookie)
        "#{cookie}; secure"
      else
        cookie
      end
    }.join("\n")
  end
end