utils.rb 528 B

12345678910111213141516171819202122
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rack/utils'
  3. module Rack
  4. module Utils
  5. module_function
  6. singleton_class.alias_method :original_add_cookie_to_header, :add_cookie_to_header
  7. # https://github.com/rack/rack/blob/2.2.3/lib/rack/session/utils.rb#L223-L262
  8. def add_cookie_to_header(header, key, value)
  9. if value.is_a?(Hash)
  10. value[:secure] = ::Session.secure_flag?
  11. end
  12. original_add_cookie_to_header(header, key, value)
  13. end
  14. end
  15. end