Sha256: 0cce43da375d70511e23b1213cf3ae0a34f32f348ff6331484289e39e4f080c1

Contents?: true

Size: 509 Bytes

Versions: 1

Compression:

Stored size: 509 Bytes

Contents

require 'rack/utils'

module Ckeditor
  class Middleware
    def initialize(app, session_key = '_session_id')
      @app = app
      @session_key = session_key
    end
   
    def call(env)
      if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave)\s+Flash/
        params = ::Rack::Utils.parse_query(env['QUERY_STRING'])
        env['HTTP_COOKIE'] = [ @session_key, ::Rack::Utils.unescape(params[@session_key]) ].join('=').freeze unless params[@session_key].nil?
      end
      @app.call(env)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ckeditor-3.5.4 lib/ckeditor/middleware.rb