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
0
Merge Requests
0
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
iv
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
Hide 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 (
"net/http"
"os"
"path"
"regexp"
"strings"
)
...
...
@@ -23,7 +24,7 @@ type gitHandler struct {
type
gitService
struct
{
method
string
suffix
string
regex
*
regexp
.
Regexp
handleFunc
func
(
w
http
.
ResponseWriter
,
r
*
gitRequest
,
rpc
string
)
rpc
string
}
...
...
@@ -54,14 +55,14 @@ type gitRequest struct {
// Routing table
var
gitServices
=
[
...
]
gitService
{
gitService
{
"GET"
,
"/info/refs"
,
handleGetInfoRefs
,
""
},
gitService
{
"POST"
,
"/git-upload-pack"
,
handlePostRPC
,
"git-upload-pack"
},
gitService
{
"POST"
,
"/git-receive-pack"
,
handlePostRPC
,
"git-receive-pack"
},
gitService
{
"GET"
,
"/repository/archive"
,
handleGetArchive
,
"tar.gz"
},
gitService
{
"GET"
,
"/repository/archive.zip"
,
handleGetArchive
,
"zip"
},
gitService
{
"GET"
,
"/repository/archive.tar"
,
handleGetArchive
,
"tar"
},
gitService
{
"GET"
,
"/repository/archive.tar.gz"
,
handleGetArchive
,
"tar.gz"
},
gitService
{
"GET"
,
"/repository/archive.tar.bz2"
,
handleGetArchive
,
"tar.bz2"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/info/refs\z`
)
,
handleGetInfoRefs
,
""
},
gitService
{
"POST"
,
regexp
.
MustCompile
(
`/git-upload-pack\z`
)
,
handlePostRPC
,
"git-upload-pack"
},
gitService
{
"POST"
,
regexp
.
MustCompile
(
`/git-receive-pack\z`
)
,
handlePostRPC
,
"git-receive-pack"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive\z`
)
,
handleGetArchive
,
"tar.gz"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.zip\z`
)
,
handleGetArchive
,
"zip"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar\z`
)
,
handleGetArchive
,
"tar"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar.gz\z`
)
,
handleGetArchive
,
"tar.gz"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar.bz2\z`
)
,
handleGetArchive
,
"tar.bz2"
},
gitService
{
"PUT"
,
"/gitlab-lfs/objects"
,
handleStoreLfsObject
,
"lfs-object-receive"
},
gitService
{
"GET"
,
"/gitlab-lfs/objects"
,
handleRetreiveLfsObject
,
"lfs-object-upload"
},
}
...
...
@@ -78,7 +79,7 @@ func (h *gitHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Look for a matching Git service
foundService
:=
false
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
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