Commit ae9e5eea authored by GitLab's avatar GitLab

Handle missing @user during Git HTTP requests

parent d3305df7
...@@ -28,7 +28,7 @@ module Grack ...@@ -28,7 +28,7 @@ module Grack
if project && authorized_request? if project && authorized_request?
if ENV['GITLAB_GRACK_AUTH_ONLY'] == '1' if ENV['GITLAB_GRACK_AUTH_ONLY'] == '1'
# Tell gitlab-git-http-server the request is OK, and what the GL_ID is # 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 else
@app.call(env) @app.call(env)
end end
...@@ -179,6 +179,15 @@ module Grack ...@@ -179,6 +179,15 @@ module Grack
end end
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 def render_not_found
[404, { "Content-Type" => "text/plain" }, ["Not Found"]] [404, { "Content-Type" => "text/plain" }, ["Not Found"]]
end end
......
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