Commit 30bf2b9c authored by Jacob Vosmaer's avatar Jacob Vosmaer

Avoid instance variable re-use trouble

This is the quickest/dumbest/safest way I could think of to prevent
the instance variable reuse problems we have on dev.gitlab.org now.
parent 308c6428
...@@ -30,7 +30,7 @@ Gitlab::Application.routes.draw do ...@@ -30,7 +30,7 @@ Gitlab::Application.routes.draw do
end end
# Enable Grack support # Enable Grack support
mount Grack::Auth.new({}), at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post] mount Grack::AuthSpawner, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post]
# Help # Help
get 'help' => 'help#index' get 'help' => 'help#index'
......
require_relative 'shell_env' require_relative 'shell_env'
module Grack module Grack
class AuthSpawner
def self.call(env)
# Avoid issues with instance variables in Grack::Auth persisting across
# requests by creating a new instance for each request.
Auth.new({}).call(env)
end
end
class Auth < Rack::Auth::Basic class Auth < Rack::Auth::Basic
attr_accessor :user, :project, :env attr_accessor :user, :project, :env
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment