# Be sure to restart your server when you modify this file

# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
  config.gem "systemu"
  config.gem "rack", :version => "1.1.3"

  config.time_zone = 'UTC'

  config.action_controller.session = {
    :session_key => '_clsi_session',
    :secret      => 'cbd744cdfaf96380fddbae8d5ca2facff1fce7f4b93c6d98feaf9986ff09e83dbd3ca79f827a0cf654f16c3c0c948acaad5d616fdbf50144708f4f10de3c855e'
  }
end

# Fix the bug described here:http://stackoverflow.com/questions/9122411/rails-javascript-too-many-parameter-keys-whats-a-good-way-to-normalize-f
# Allows the CLSI to handle large POST requests
Rack::Utils.key_space_limit = 262144


# Be sure to restart your server when you modify this file

# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
  config.gem "systemu"
  config.gem "rack", :version => "1.1.3"

  config.time_zone = 'UTC'

  config.action_controller.session = {
    :session_key => '_clsi_session',
    :secret      => 'cbd744cdfaf96380fddbae8d5ca2facff1fce7f4b93c6d98feaf9986ff09e83dbd3ca79f827a0cf654f16c3c0c948acaad5d616fdbf50144708f4f10de3c855e'
  }
end

# This ensures the POST data is never parsed. Doing so can overload the parser with
# large requests and we parse it ourselves later.
Rack::Request::FORM_DATA_MEDIA_TYPES.clear
Rack::Request::PARSEABLE_DATA_MEDIA_TYPES.clear


Fix "exceeded available parameter key space" bug with large POST requests
Fix "exceeded available parameter key space" bug with large POST requests

Rack attempts to parse the POST data as a form if the Content-Type header
matches one of its understood formats. Sometimes the Content-Type header
is not set correctly by calls to the API and it tries to parse large requests.
We blank the types it tries to parse so that it never attempts to parse.
This might be a problem if we want to create other pages, but for the API
end point it is fine.
