AuraRepo > Commit [d2ab8e6]
Thu February 20, 2025 2:00 AM -0600
Add basic HTTP homepage http.go | 9 ++++++---
Commit Hash: d2ab8e63c41e3c51ea7c91f842d9c5c5f81dc2cc
Tree Hash: a831c95c08faf71245a4c2eff6ebe5b012242f61
Date: 2025-02-20T02:00:47-06:00
PGP Signature: -----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQSghH500ekD7Pc/Zj6PbjnL2ZXQ4AUCZ7bhLwAKCRCPbjnL2ZXQ
4Nt3AP9cIvycXK62bvQ/SJAkuBHsiXzjKndxRbqPNiJVW7yqvgD/bkNMtrDcUMHH
+7wUp92EZELLn00GSywaM1MMJ8af8gI=
=HGwA
-----END PGP SIGNATURE-----
Changes
http.go
... | ...
1 | package aurarepo
2 |
3 | import (
4 | "net/http"
5 | "net/http/cgi"
- 6 | "path"
7 | )
8 |
9 | // Used to serve repos over HTTP via the smart protocol.
10 | func (c *AuraRepoContext) AttachHTTPSmart(mux *http.ServeMux) {
... | ...
6 | )
7 |
8 | // Used to serve repos over HTTP via the smart protocol.
9 | func (c *AuraRepoContext) AttachHTTPSmart(mux *http.ServeMux) {
+ 10 | mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
+ 11 | w.WriteHeader(http.StatusOK)
+ 12 | w.Write([]byte(`AuraRepo Homepage`))
+ 13 | })
+ 14 |
11 | mux.HandleFunc("/{namespace}/", func(w http.ResponseWriter, r *http.Request) {
... | ...
7 | mux.HandleFunc("/{namespace}/", func(w http.ResponseWriter, r *http.Request) {
- 12 | namespace := r.PathValue("namespace")
13 | gitProtocol := r.Header.Get("HTTP_GIT_PROTOCOL")
14 |
15 | handler := &cgi.Handler{
16 | Path: "/usr/lib/git-core/git-http-backend",
17 | Dir: c.repos_directory,
... | ...
14 |
15 | handler := &cgi.Handler{
16 | Path: "/usr/lib/git-core/git-http-backend",
17 | Dir: c.repos_directory,
18 | Env: []string{
- 19 | "GIT_PROJECT_ROOT=" + path.Join(c.repos_directory, namespace),
+ 22 | "GIT_PROJECT_ROOT=" + c.repos_directory,
20 | //"GIT_PROJECT_ROOT=/home/git/" + namespace,
21 | "GIT_PROTOCOL=" + gitProtocol,
22 | //"GIT_HTTP_EXPORT_ALL=1",
23 | },
24 | }