Skip to content

Commit

Permalink
Fix weird bug with action dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
adman65 committed Jan 19, 2012
1 parent e6c4446 commit e33b3f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
9 changes: 8 additions & 1 deletion lib/http_log/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def initialize(app)
end

def call(env)
@proxy = RequestProxy.new(env.dup)
@proxy = RequestProxy.new(env)

if passes_filters?
request = HttpLog::Request.from_request(@proxy)
Expand All @@ -18,6 +18,13 @@ def call(env)
env['http_log.request_id'] = request.id.to_s
end

# Wipe away all remains of anything action_dispatch does.
# Apparently it modifies the env in such a way that
# that all the paramters do not make it to the controller.
env.keys.select {|k| k =~ /action_dispatch/}.each do |k|
env.delete k
end

@app.call env
end

Expand Down
14 changes: 0 additions & 14 deletions lib/http_log/request_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,9 @@ def header_hash
hash
end

def url
base = "#{protocol}://#{http_host || server_name}#{path_info}"
base = "#{base}?#{query_string}" if query_string.present?
base
end

private
def action_dispatch_request
@action_dispatch_request
end

def http_host
headers['Host']
end

def protocol
env['rack.url_scheme']
end
end
end

0 comments on commit e33b3f9

Please sign in to comment.