Sha256: 182cbdd5df55728ecfcbf8afaccfa9272aef603ef557dcfdf1f73c4d34865d31

Contents?: true

Size: 498 Bytes

Versions: 10

Compression:

Stored size: 498 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/
        params = ::Rack::Utils.parse_query(env['QUERY_STRING'])
        env['HTTP_COOKIE'] = [ @session_key, params[@session_key] ].join('=').freeze unless params[@session_key].nil?
      end
      @app.call(env)
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
jbasdf-uploader-0.1.8 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-0.1.13 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-0.1.10 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-0.1.14 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-0.1.12 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-0.1.15 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-0.1.3 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-0.1.9 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-0.1.7 lib/uploader/middleware/flash_session_cookie_middleware.rb
uploader-0.1.8 lib/uploader/middleware/flash_session_cookie_middleware.rb