diff options
author | GitLab <example@example.com> | 2015-07-28 15:17:06 +0200 |
---|---|---|
committer | GitLab <example@example.com> | 2015-07-28 15:17:06 +0200 |
commit | ae9e5eea3c6955d278182005808fbdfccd4d447b (patch) | |
tree | 63313cbb4fa300aaa8e54c4b578d0e9a278821c3 /lib | |
parent | d3305df7aac4e632707492118a0ce91e67ed74ce (diff) | |
download | gitlab-ce-ae9e5eea3c6955d278182005808fbdfccd4d447b.tar.gz |
Handle missing @user during Git HTTP requests
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/backend/grack_auth.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb index f7fc97651f2..5966d394b62 100644 --- a/lib/gitlab/backend/grack_auth.rb +++ b/lib/gitlab/backend/grack_auth.rb @@ -28,7 +28,7 @@ module Grack if project && authorized_request? if ENV['GITLAB_GRACK_AUTH_ONLY'] == '1' # Tell gitlab-git-http-server the request is OK, and what the GL_ID is - [200, { "Content-Type" => "text/plain" }, [Gitlab::ShellEnv.gl_id(@user)]] + render_grack_auth_ok else @app.call(env) end @@ -179,6 +179,15 @@ module Grack end end + def render_grack_auth_ok + if @user.present? + body = Gitlab::ShellEnv.gl_id(@user) + else + body = '' + end + [200, { "Content-Type" => "text/plain" }, [body]] + end + def render_not_found [404, { "Content-Type" => "text/plain" }, ["Not Found"]] end |