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
34fa7497
Commit
34fa7497
authored
Dec 18, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use http.Handler in httpRoute
parent
570911ae
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
main.go
main.go
+5
-5
upstream.go
upstream.go
+1
-1
No files found.
main.go
View file @
34fa7497
...
...
@@ -43,7 +43,7 @@ var developmentMode = flag.Bool("developmentMode", false, "Allow to serve assets
type
httpRoute
struct
{
method
string
regex
*
regexp
.
Regexp
handle
Func
httpHandleFunc
handle
r
http
.
Handler
}
type
httpHandleFunc
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
...
...
@@ -93,8 +93,8 @@ func compileRoutes(u *upstream) {
httpRoute
{
"POST"
,
regexp
.
MustCompile
(
ciAPIPattern
+
`v1/builds/[0-9]+/artifacts\z`
),
contentEncodingHandler
(
api
.
artifactsAuthorizeHandler
(
handleFileUploads
(
proxy
)))},
// Explicitly proxy API requests
httpRoute
{
""
,
regexp
.
MustCompile
(
apiPattern
),
proxy
.
ServeHTTP
},
httpRoute
{
""
,
regexp
.
MustCompile
(
ciAPIPattern
),
proxy
.
ServeHTTP
},
httpRoute
{
""
,
regexp
.
MustCompile
(
apiPattern
),
proxy
},
httpRoute
{
""
,
regexp
.
MustCompile
(
ciAPIPattern
),
proxy
},
// Serve assets
httpRoute
{
""
,
regexp
.
MustCompile
(
`^/assets/`
),
...
...
upstream.go
View file @
34fa7497
...
...
@@ -139,5 +139,5 @@ func (u *upstream) ServeHTTP(ow http.ResponseWriter, r *http.Request) {
return
}
g
.
handle
Func
(
&
w
,
r
)
g
.
handle
r
.
ServeHTTP
(
&
w
,
r
)
}
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