Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't clone env (fixes bug with Warden/Devise)

  • Loading branch information...
commit 4b05cbd73053e8b15ab2249a6383414129465448 1 parent 2b3bdee
@bhb authored
View
4 lib/rack/perftools_profiler/profile_once.rb
@@ -34,7 +34,9 @@ def response
end
def delete_custom_params(env)
- new_env = env.clone
+ # I used to clone the env, but it broke any apps that used Warden
+ # ex) new_env = env.clone
+ new_env = env
get_params = Rack::Request.new(new_env).GET
get_params.delete('profile')
View
4 lib/rack/perftools_profiler/profiler_middleware.rb
@@ -20,7 +20,9 @@ def initialize(app, options = {})
end
def call(env)
- @env = env.clone
+ # I used to clone the env, but it broke any apps that used Warden
+ # ex) @env = env.clone
+ @env = env
action = Action.for_env(@env, @profiler, self)
action.act
action.response
View
BIN  rack-perftools_profiler-0.4.1.gem
Binary file not shown
View
13 rack-perftools_profiler.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{rack-perftools_profiler}
- s.version = "0.4.0"
+ s.version = "0.4.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Ben Brinckerhoff"]
- s.date = %q{2011-01-16}
+ s.date = %q{2011-06-02}
s.description = %q{Middleware for profiling Rack-compatible apps using perftools.rb}
s.email = %q{ben@bbrinck.com}
s.extra_rdoc_files = [
@@ -41,17 +41,10 @@ Gem::Specification.new do |s|
]
s.homepage = %q{http://github.com/bhb/rack-perftools_profiler}
s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.7}
+ s.rubygems_version = %q{1.6.2}
s.summary = %q{Middleware for profiling Rack-compatible apps using perftools.rb}
- s.test_files = [
- "test/multiple_request_profiling_test.rb",
- "test/rack-perftools-profiler_test.rb",
- "test/single_request_profiling_test.rb",
- "test/test_helper.rb"
- ]
if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
View
8 test/multiple_request_profiling_test.rb
@@ -300,7 +300,9 @@ def profile_requests(profiled_app, requests, options = {})
profiled_app = Rack::PerftoolsProfiler.new(app, :default_printer => 'text')
profiled_app.call(@start_env)
profiled_app.call(env)
- assert_equal env, old_env
+ # I used to clone the environment to avoid conflicts, but this seems to break
+ # Devise/Warden.
+ # assert_equal env, old_env
end
should 'pass on non-profiling params in environment' do
@@ -314,7 +316,9 @@ def profile_requests(profiled_app, requests, options = {})
profiled_app = Rack::PerftoolsProfiler.new(app, :default_printer => 'text')
profiled_app.call(@start_env)
profiled_app.call(env)
- assert_equal env, old_env
+ # I used to clone the environment to avoid conflicts, but this seems to break
+ # Devise/Warden.
+ # assert_equal env, old_env
end
should 'not alter regular calls' do
View
4 test/single_request_profiling_test.rb
@@ -272,7 +272,9 @@ def setup
app = @app.clone
app.expects(:call).with(expected_env)
Rack::PerftoolsProfiler.new(app, :default_printer => 'gif').call(env)
- assert_equal env, old_env
+ # I used to clone the environment to avoid conflicts, but this seems to break
+ # Devise/Warden.
+ # assert_equal env, old_env
end
context "when request is not GET" do
Please sign in to comment.
Something went wrong with that request. Please try again.