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.
This commit is contained in:
parent
308c6428ae
commit
30bf2b9cc3
2 changed files with 9 additions and 1 deletions
|
@ -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'
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue