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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-workhorse
Commits
d64c1a61
Commit
d64c1a61
authored
Dec 17, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename handleFunc type to httpHandleFunc
parent
e783a3d0
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
11 additions
and
11 deletions
+11
-11
artifacts.go
artifacts.go
+1
-1
authorization.go
authorization.go
+1
-1
deploy_page.go
deploy_page.go
+1
-1
development.go
development.go
+1
-1
error_pages.go
error_pages.go
+1
-1
git-http.go
git-http.go
+1
-1
handlers.go
handlers.go
+1
-1
lfs.go
lfs.go
+1
-1
main.go
main.go
+2
-2
servefile.go
servefile.go
+1
-1
No files found.
artifacts.go
View file @
d64c1a61
...
@@ -4,7 +4,7 @@ import (
...
@@ -4,7 +4,7 @@ import (
"net/http"
"net/http"
)
)
func
(
u
*
upstream
)
artifactsAuthorizeHandler
(
h
h
andleFunc
)
h
andleFunc
{
func
(
u
*
upstream
)
artifactsAuthorizeHandler
(
h
h
ttpHandleFunc
)
httpH
andleFunc
{
return
u
.
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
gitRequest
)
{
return
u
.
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
gitRequest
)
{
req
:=
r
.
Request
req
:=
r
.
Request
req
.
Header
.
Set
(
tempPathHeader
,
r
.
TempPath
)
req
.
Header
.
Set
(
tempPathHeader
,
r
.
TempPath
)
...
...
authorization.go
View file @
d64c1a61
...
@@ -51,7 +51,7 @@ func (u *upstream) newUpstreamRequest(r *http.Request, body io.Reader, suffix st
...
@@ -51,7 +51,7 @@ func (u *upstream) newUpstreamRequest(r *http.Request, body io.Reader, suffix st
return
authReq
,
nil
return
authReq
,
nil
}
}
func
(
u
*
upstream
)
preAuthorizeHandler
(
h
serviceHandleFunc
,
suffix
string
)
handleFunc
{
func
(
u
*
upstream
)
preAuthorizeHandler
(
h
serviceHandleFunc
,
suffix
string
)
h
ttpH
andleFunc
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
authReq
,
err
:=
u
.
newUpstreamRequest
(
r
,
nil
,
suffix
)
authReq
,
err
:=
u
.
newUpstreamRequest
(
r
,
nil
,
suffix
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
deploy_page.go
View file @
d64c1a61
...
@@ -6,7 +6,7 @@ import (
...
@@ -6,7 +6,7 @@ import (
"path/filepath"
"path/filepath"
)
)
func
handleDeployPage
(
documentRoot
*
string
,
handler
h
andleFunc
)
h
andleFunc
{
func
handleDeployPage
(
documentRoot
*
string
,
handler
h
ttpHandleFunc
)
httpH
andleFunc
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
deployPage
:=
filepath
.
Join
(
*
documentRoot
,
"index.html"
)
deployPage
:=
filepath
.
Join
(
*
documentRoot
,
"index.html"
)
data
,
err
:=
ioutil
.
ReadFile
(
deployPage
)
data
,
err
:=
ioutil
.
ReadFile
(
deployPage
)
...
...
development.go
View file @
d64c1a61
...
@@ -2,7 +2,7 @@ package main
...
@@ -2,7 +2,7 @@ package main
import
"net/http"
import
"net/http"
func
handleDevelopmentMode
(
developmentMode
*
bool
,
handler
h
andleFunc
)
h
andleFunc
{
func
handleDevelopmentMode
(
developmentMode
*
bool
,
handler
h
ttpHandleFunc
)
httpH
andleFunc
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
if
!*
developmentMode
{
if
!*
developmentMode
{
http
.
NotFound
(
w
,
r
)
http
.
NotFound
(
w
,
r
)
...
...
error_pages.go
View file @
d64c1a61
...
@@ -59,7 +59,7 @@ func (s *errorPageResponseWriter) Flush() {
...
@@ -59,7 +59,7 @@ func (s *errorPageResponseWriter) Flush() {
s
.
WriteHeader
(
http
.
StatusOK
)
s
.
WriteHeader
(
http
.
StatusOK
)
}
}
func
handleRailsError
(
documentRoot
*
string
,
handler
h
andleFunc
)
h
andleFunc
{
func
handleRailsError
(
documentRoot
*
string
,
handler
h
ttpHandleFunc
)
httpH
andleFunc
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
rw
:=
errorPageResponseWriter
{
rw
:=
errorPageResponseWriter
{
rw
:
w
,
rw
:
w
,
...
...
git-http.go
View file @
d64c1a61
...
@@ -26,7 +26,7 @@ func looksLikeRepo(p string) bool {
...
@@ -26,7 +26,7 @@ func looksLikeRepo(p string) bool {
return
true
return
true
}
}
func
(
u
*
upstream
)
repoPreAuthorizeHandler
(
handleFunc
serviceHandleFunc
)
handleFunc
{
func
(
u
*
upstream
)
repoPreAuthorizeHandler
(
handleFunc
serviceHandleFunc
)
h
ttpH
andleFunc
{
return
u
.
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
gitRequest
)
{
return
u
.
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
gitRequest
)
{
if
r
.
RepoPath
==
""
{
if
r
.
RepoPath
==
""
{
fail500
(
w
,
errors
.
New
(
"repoPreAuthorizeHandler: RepoPath empty"
))
fail500
(
w
,
errors
.
New
(
"repoPreAuthorizeHandler: RepoPath empty"
))
...
...
handlers.go
View file @
d64c1a61
...
@@ -7,7 +7,7 @@ import (
...
@@ -7,7 +7,7 @@ import (
"net/http"
"net/http"
)
)
func
contentEncodingHandler
(
h
h
andleFunc
)
h
andleFunc
{
func
contentEncodingHandler
(
h
h
ttpHandleFunc
)
httpH
andleFunc
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
var
body
io
.
ReadCloser
var
body
io
.
ReadCloser
var
err
error
var
err
error
...
...
lfs.go
View file @
d64c1a61
...
@@ -17,7 +17,7 @@ import (
...
@@ -17,7 +17,7 @@ import (
"path/filepath"
"path/filepath"
)
)
func
(
u
*
upstream
)
lfsAuthorizeHandler
(
handleFunc
serviceHandleFunc
)
handleFunc
{
func
(
u
*
upstream
)
lfsAuthorizeHandler
(
handleFunc
serviceHandleFunc
)
h
ttpH
andleFunc
{
return
u
.
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
gitRequest
)
{
return
u
.
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
gitRequest
)
{
if
r
.
StoreLFSPath
==
""
{
if
r
.
StoreLFSPath
==
""
{
...
...
main.go
View file @
d64c1a61
...
@@ -43,10 +43,10 @@ var developmentMode = flag.Bool("developmentMode", false, "Allow to serve assets
...
@@ -43,10 +43,10 @@ var developmentMode = flag.Bool("developmentMode", false, "Allow to serve assets
type
httpRoute
struct
{
type
httpRoute
struct
{
method
string
method
string
regex
*
regexp
.
Regexp
regex
*
regexp
.
Regexp
handleFunc
handleFunc
handleFunc
h
ttpH
andleFunc
}
}
type
handleFunc
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
type
h
ttpH
andleFunc
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
const
projectPattern
=
`^/[^/]+/[^/]+/`
const
projectPattern
=
`^/[^/]+/[^/]+/`
const
gitProjectPattern
=
`^/[^/]+/[^/]+\.git/`
const
gitProjectPattern
=
`^/[^/]+/[^/]+\.git/`
...
...
servefile.go
View file @
d64c1a61
...
@@ -16,7 +16,7 @@ const (
...
@@ -16,7 +16,7 @@ const (
CacheExpireMax
CacheExpireMax
)
)
func
(
u
*
upstream
)
handleServeFile
(
documentRoot
*
string
,
cache
CacheMode
,
notFoundHandler
h
andleFunc
)
h
andleFunc
{
func
(
u
*
upstream
)
handleServeFile
(
documentRoot
*
string
,
cache
CacheMode
,
notFoundHandler
h
ttpHandleFunc
)
httpH
andleFunc
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
file
:=
filepath
.
Join
(
*
documentRoot
,
u
.
relativeURIPath
(
cleanURIPath
(
r
.
URL
.
Path
)))
file
:=
filepath
.
Join
(
*
documentRoot
,
u
.
relativeURIPath
(
cleanURIPath
(
r
.
URL
.
Path
)))
...
...
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