Commit d9f794a8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'grack-auth-new-instance' into 'master'

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.

See merge request !1237
parents 28219ea9 30bf2b9c
......@@ -30,7 +30,7 @@ Gitlab::Application.routes.draw do
end
# 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
get 'help' => 'help#index'
......
require_relative 'shell_env'
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
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