diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-13 15:16:11 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-13 15:16:11 +0800 |
commit | 1364d688e454454258c6c97b1dc844cc94a67a9e (patch) | |
tree | f95b9370cff76eeba71b86dbcd7333586ba1f7a9 /http_handle_repo_info.go | |
parent | {http,ssh}_server.go: Add debug logs for incoming requests (diff) | |
download | forge-1364d688e454454258c6c97b1dc844cc94a67a9e.tar.gz forge-1364d688e454454258c6c97b1dc844cc94a67a9e.tar.zst forge-1364d688e454454258c6c97b1dc844cc94a67a9e.zip |
ssh_url_generation.go, etc.: Add config ssh.root and use it
Detecting it based on HTTP host name is definitely unreliable.
Just add a configuration option and it should work.
Diffstat (limited to 'http_handle_repo_info.go')
-rw-r--r-- | http_handle_repo_info.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/http_handle_repo_info.go b/http_handle_repo_info.go index e220f18..f5b9dfd 100644 --- a/http_handle_repo_info.go +++ b/http_handle_repo_info.go @@ -2,9 +2,8 @@ package main import ( "net/http" - "net/url" ) func handle_repo_info(w http.ResponseWriter, r *http.Request, params map[string]any) { - http.Error(w, "\x1b[1;93mHi! We do not support Git operations over HTTP yet.\x1b[0m\n\x1b[1;93mMeanwhile, please use ssh by simply replacing the scheme with \"ssh://\":\x1b[0m\n\x1b[1;93mssh://"+r.Host+"/"+url.PathEscape(params["group_name"].(string))+"/:/repos/"+url.PathEscape(params["repo_name"].(string))+"\x1b[0m", http.StatusNotImplemented) + http.Error(w, "\x1b[1;93mHi! We do not support Git operations over HTTP yet.\x1b[0m\n\x1b[1;93mMeanwhile, please use ssh by simply replacing the scheme with \"ssh://\":\x1b[0m\n\x1b[1;93m"+ generate_ssh_remote_url(params["group_name"].(string), params["repo_name"].(string)) + "\x1b[0m", http.StatusNotImplemented) } |