Sha256: 60af3eb037456820631f03c407b3ad87ab2c329e7e259c6ac88471d45a72c80f

Contents?: true

Size: 584 Bytes

Versions: 14

Compression:

Stored size: 584 Bytes

Contents

require 'rack/utils'

module Uploader
  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, 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
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
uploader-3.1.4 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-3.1.3 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-3.1.2 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-3.1.1 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-3.1.0 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-3.0.2 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-3.0.1 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-3.0.0 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-2.0.2 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-2.0.0 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-1.0.3 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-1.0.2 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-1.0.1 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-1.0.0 lib/uploader/middleware/flash_session_cookie_middleware.rb