Sha256: 29ec5573de2e456a58cae7e2417ec94338037ed27e3f38af8e72d98e4936c6cc

Contents?: true

Size: 646 Bytes

Versions: 56

Compression:

Stored size: 646 Bytes

Contents

require 'rack/utils'

class FlashSessionCookieMiddleware
  def initialize(app, session_key = '_session_id')
    @app = app
    @session_key = session_key
  end

  def call(env)
    if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
      req = Rack::Request.new(env)
      env['HTTP_COOKIE'] = [ @session_key,
                             ::Rack::Utils.escape(req.params[@session_key]) ].
                           join('=').freeze unless req.params[@session_key].nil?
      env['HTTP_ACCEPT'] = "#{req.params['_http_accept']}".
                           freeze unless req.params['_http_accept'].nil?
    end
    @app.call(env)
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
wheels-0.0.38 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.37 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.36 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.35 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.34 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.33 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.32 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.31 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.30 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.29 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.28 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.27 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.26 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.25 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.24 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.0.23 lib/wheels/flash_session_cookie_middleware.rb