Created
September 11, 2010 23:35
-
-
Save ebertech/575682 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e2e1789a8546cee99fcf07a4b44a0515d1e3a52e Mon Sep 17 00:00:00 2001 | |
From: Andrew Eberbach <andrew@ebertech.ca> | |
Date: Sat, 11 Sep 2010 19:32:29 -0400 | |
Subject: [PATCH] fixes issue 22. The SQL toolbar could not send profile, explain and select requests because the middleware would not process xhr requests | |
--- | |
lib/rack/bug.rb | 6 +++++- | |
1 files changed, 5 insertions(+), 1 deletions(-) | |
diff --git a/lib/rack/bug.rb b/lib/rack/bug.rb | |
index 0be38f5..ead8a40 100644 | |
--- a/lib/rack/bug.rb | |
+++ b/lib/rack/bug.rb | |
@@ -38,7 +38,7 @@ class Rack::Bug | |
@env = env | |
@original_request = Rack::Request.new(@env) | |
- if toolbar_requested? && ip_authorized? && password_authorized? && !@original_request.xhr? | |
+ if toolbar_requested? && ip_authorized? && password_authorized? && toolbar_xhr? | |
@toolbar.call(env) | |
else | |
@app.call(env) | |
@@ -47,6 +47,10 @@ class Rack::Bug | |
private | |
+ def toolbar_xhr? | |
+ !@original_request.xhr? || @original_request.path =~ /^\/__rack_bug__/ | |
+ end | |
+ | |
def asset_server(app) | |
RackStaticBugAvoider.new(app, Rack::Static.new(app, :urls => ["/__rack_bug__"], :root => public_path)) | |
end | |
-- | |
1.7.0.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment