Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
a946f280
Commit
a946f280
authored
Nov 02, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into lfs_support
parents
a188c206
ed976a2f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
githandler.go
githandler.go
+11
-10
No files found.
githandler.go
View file @
a946f280
...
@@ -13,6 +13,7 @@ import (
...
@@ -13,6 +13,7 @@ import (
"net/http"
"net/http"
"os"
"os"
"path"
"path"
"regexp"
"strings"
"strings"
)
)
...
@@ -23,7 +24,7 @@ type gitHandler struct {
...
@@ -23,7 +24,7 @@ type gitHandler struct {
type
gitService
struct
{
type
gitService
struct
{
method
string
method
string
suffix
string
regex
*
regexp
.
Regexp
handleFunc
func
(
w
http
.
ResponseWriter
,
r
*
gitRequest
,
rpc
string
)
handleFunc
func
(
w
http
.
ResponseWriter
,
r
*
gitRequest
,
rpc
string
)
rpc
string
rpc
string
}
}
...
@@ -54,14 +55,14 @@ type gitRequest struct {
...
@@ -54,14 +55,14 @@ type gitRequest struct {
// Routing table
// Routing table
var
gitServices
=
[
...
]
gitService
{
var
gitServices
=
[
...
]
gitService
{
gitService
{
"GET"
,
"/info/refs"
,
handleGetInfoRefs
,
""
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/info/refs\z`
)
,
handleGetInfoRefs
,
""
},
gitService
{
"POST"
,
"/git-upload-pack"
,
handlePostRPC
,
"git-upload-pack"
},
gitService
{
"POST"
,
regexp
.
MustCompile
(
`/git-upload-pack\z`
)
,
handlePostRPC
,
"git-upload-pack"
},
gitService
{
"POST"
,
"/git-receive-pack"
,
handlePostRPC
,
"git-receive-pack"
},
gitService
{
"POST"
,
regexp
.
MustCompile
(
`/git-receive-pack\z`
)
,
handlePostRPC
,
"git-receive-pack"
},
gitService
{
"GET"
,
"/repository/archive"
,
handleGetArchive
,
"tar.gz"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive\z`
)
,
handleGetArchive
,
"tar.gz"
},
gitService
{
"GET"
,
"/repository/archive.zip"
,
handleGetArchive
,
"zip"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.zip\z`
)
,
handleGetArchive
,
"zip"
},
gitService
{
"GET"
,
"/repository/archive.tar"
,
handleGetArchive
,
"tar"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar\z`
)
,
handleGetArchive
,
"tar"
},
gitService
{
"GET"
,
"/repository/archive.tar.gz"
,
handleGetArchive
,
"tar.gz"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar.gz\z`
)
,
handleGetArchive
,
"tar.gz"
},
gitService
{
"GET"
,
"/repository/archive.tar.bz2"
,
handleGetArchive
,
"tar.bz2"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar.bz2\z`
)
,
handleGetArchive
,
"tar.bz2"
},
gitService
{
"PUT"
,
"/gitlab-lfs/objects"
,
handleStoreLfsObject
,
"lfs-object-receive"
},
gitService
{
"PUT"
,
"/gitlab-lfs/objects"
,
handleStoreLfsObject
,
"lfs-object-receive"
},
gitService
{
"GET"
,
"/gitlab-lfs/objects"
,
handleRetreiveLfsObject
,
"lfs-object-upload"
},
gitService
{
"GET"
,
"/gitlab-lfs/objects"
,
handleRetreiveLfsObject
,
"lfs-object-upload"
},
}
}
...
@@ -78,7 +79,7 @@ func (h *gitHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
...
@@ -78,7 +79,7 @@ func (h *gitHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Look for a matching Git service
// Look for a matching Git service
foundService
:=
false
foundService
:=
false
for
_
,
g
=
range
gitServices
{
for
_
,
g
=
range
gitServices
{
if
r
.
Method
==
g
.
method
&&
strings
.
Contains
(
r
.
URL
.
Path
,
g
.
suffix
)
{
if
r
.
Method
==
g
.
method
&&
g
.
regex
.
MatchString
(
r
.
URL
.
Path
)
{
foundService
=
true
foundService
=
true
break
break
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment