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
Kazuhiko Shiozaki
gitlab-workhorse
Commits
b0525d6c
Commit
b0525d6c
authored
Dec 17, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compile routes later during boot
parent
bd5ec001
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
45 deletions
+51
-45
main.go
main.go
+50
-45
main_test.go
main_test.go
+1
-0
No files found.
main.go
View file @
b0525d6c
...
...
@@ -57,7 +57,10 @@ const ciAPIPattern = `^/ci/api/`
// Routing table
// We match against URI not containing the relativeUrlRoot:
// see upstream.ServeHTTP
var
httpRoutes
=
[
...
]
httpRoute
{
var
httpRoutes
[]
httpRoute
func
compileRoutes
()
{
httpRoutes
=
[]
httpRoute
{
// Git Clone
httpRoute
{
"GET"
,
regexp
.
MustCompile
(
gitProjectPattern
+
`info/refs\z`
),
repoPreAuthorizeHandler
(
handleGetInfoRefs
)},
httpRoute
{
"POST"
,
regexp
.
MustCompile
(
gitProjectPattern
+
`git-upload-pack\z`
),
repoPreAuthorizeHandler
(
contentEncodingHandler
(
handlePostRPC
))},
...
...
@@ -108,6 +111,7 @@ var httpRoutes = [...]httpRoute{
),
),
},
}
}
func
main
()
{
...
...
@@ -169,5 +173,6 @@ func main() {
}
upstream
:=
newUpstream
(
*
authBackend
,
proxyTransport
)
compileRoutes
()
log
.
Fatal
(
http
.
Serve
(
listener
,
upstream
))
}
main_test.go
View file @
b0525d6c
...
...
@@ -326,6 +326,7 @@ func testAuthServer(url *regexp.Regexp, code int, body interface{}) *httptest.Se
}
func
startWorkhorseServer
(
authBackend
string
)
*
httptest
.
Server
{
compileRoutes
()
return
httptest
.
NewServer
(
newUpstream
(
authBackend
,
nil
))
}
...
...
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