Commit 7808e1cc authored by Jacob Vosmaer's avatar Jacob Vosmaer

Use an early return in handle_get_info_refs

parent d9bc0d49
......@@ -149,8 +149,12 @@ func do_auth_request(r *http.Request) (result *http.Response, err error) {
func handle_get_info_refs(gl_id string, _ string, path string, w http.ResponseWriter, r *http.Request) {
rpc := r.URL.Query().Get("service")
switch rpc {
case "git-upload-pack", "git-receive-pack":
if !(rpc == "git-upload-pack" || rpc == "git-receive-pack") {
// The 'dumb' Git HTTP protocol is not supported
http.Error(w, "Not Found", 404)
return
}
// Prepare our Git subprocess
cmd := exec.Command("git", sub_command(rpc), "--stateless-rpc", "--advertise-refs", path)
set_cmd_env(cmd, gl_id)
......@@ -181,11 +185,6 @@ func handle_get_info_refs(gl_id string, _ string, path string, w http.ResponseWr
if err := cmd.Wait(); err != nil {
panic(err)
}
case "":
// The 'dumb' Git HTTP protocol is not supported
http.Error(w, "Not Found", 404)
return
}
}
func sub_command(rpc string) string {
......
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