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
ffa068f5
Commit
ffa068f5
authored
Dec 18, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename authorizationResponse to apiResponse
parent
59dc7cdc
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
17 deletions
+17
-17
archive.go
archive.go
+1
-1
artifacts.go
artifacts.go
+1
-1
authorization.go
authorization.go
+1
-1
authorization_test.go
authorization_test.go
+5
-5
git-http.go
git-http.go
+3
-3
lfs.go
lfs.go
+2
-2
main_test.go
main_test.go
+2
-2
upstream.go
upstream.go
+2
-2
No files found.
archive.go
View file @
ffa068f5
...
...
@@ -17,7 +17,7 @@ import (
"time"
)
func
handleGetArchive
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
uthorization
Response
)
{
func
handleGetArchive
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
pi
Response
)
{
var
format
string
urlPath
:=
r
.
URL
.
Path
switch
filepath
.
Base
(
urlPath
)
{
...
...
artifacts.go
View file @
ffa068f5
...
...
@@ -5,7 +5,7 @@ import (
)
func
(
api
*
API
)
artifactsAuthorizeHandler
(
h
httpHandleFunc
)
httpHandleFunc
{
return
api
.
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
uthorization
Response
)
{
return
api
.
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
pi
Response
)
{
r
.
Header
.
Set
(
tempPathHeader
,
a
.
TempPath
)
h
(
w
,
r
)
},
"/authorize"
)
...
...
authorization.go
View file @
ffa068f5
...
...
@@ -86,7 +86,7 @@ func (api *API) preAuthorizeHandler(h serviceHandleFunc, suffix string) httpHand
return
}
a
:=
&
a
uthorization
Response
{}
a
:=
&
a
pi
Response
{}
// The auth backend validated the client request and told us additional
// request metadata. We must extract this information from the auth
// response body.
...
...
authorization_test.go
View file @
ffa068f5
...
...
@@ -8,14 +8,14 @@ import (
"testing"
)
func
okHandler
(
w
http
.
ResponseWriter
,
_
*
http
.
Request
,
_
*
a
uthorization
Response
)
{
func
okHandler
(
w
http
.
ResponseWriter
,
_
*
http
.
Request
,
_
*
a
pi
Response
)
{
w
.
WriteHeader
(
201
)
fmt
.
Fprint
(
w
,
"{
\"
status
\"
:
\"
ok
\"
}"
)
}
func
runPreAuthorizeHandler
(
t
*
testing
.
T
,
suffix
string
,
url
*
regexp
.
Regexp
,
a
uthorization
Response
interface
{},
returnCode
,
expectedCode
int
)
*
httptest
.
ResponseRecorder
{
func
runPreAuthorizeHandler
(
t
*
testing
.
T
,
suffix
string
,
url
*
regexp
.
Regexp
,
a
pi
Response
interface
{},
returnCode
,
expectedCode
int
)
*
httptest
.
ResponseRecorder
{
// Prepare test server and backend
ts
:=
testAuthServer
(
url
,
returnCode
,
a
uthorization
Response
)
ts
:=
testAuthServer
(
url
,
returnCode
,
a
pi
Response
)
defer
ts
.
Close
()
// Create http request
...
...
@@ -35,7 +35,7 @@ func TestPreAuthorizeHappyPath(t *testing.T) {
runPreAuthorizeHandler
(
t
,
"/authorize"
,
regexp
.
MustCompile
(
`/authorize\z`
),
&
a
uthorization
Response
{},
&
a
pi
Response
{},
200
,
201
)
}
...
...
@@ -43,7 +43,7 @@ func TestPreAuthorizeSuffix(t *testing.T) {
runPreAuthorizeHandler
(
t
,
"/different-authorize"
,
regexp
.
MustCompile
(
`/authorize\z`
),
&
a
uthorization
Response
{},
&
a
pi
Response
{},
200
,
404
)
}
...
...
git-http.go
View file @
ffa068f5
...
...
@@ -27,7 +27,7 @@ func looksLikeRepo(p string) bool {
}
func
(
api
*
API
)
repoPreAuthorizeHandler
(
handleFunc
serviceHandleFunc
)
httpHandleFunc
{
return
api
.
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
uthorization
Response
)
{
return
api
.
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
pi
Response
)
{
if
a
.
RepoPath
==
""
{
fail500
(
w
,
errors
.
New
(
"repoPreAuthorizeHandler: RepoPath empty"
))
return
...
...
@@ -42,7 +42,7 @@ func (api *API) repoPreAuthorizeHandler(handleFunc serviceHandleFunc) httpHandle
},
""
)
}
func
handleGetInfoRefs
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
uthorization
Response
)
{
func
handleGetInfoRefs
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
pi
Response
)
{
rpc
:=
r
.
URL
.
Query
()
.
Get
(
"service"
)
if
!
(
rpc
==
"git-upload-pack"
||
rpc
==
"git-receive-pack"
)
{
// The 'dumb' Git HTTP protocol is not supported
...
...
@@ -86,7 +86,7 @@ func handleGetInfoRefs(w http.ResponseWriter, r *http.Request, a *authorizationR
}
}
func
handlePostRPC
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
uthorization
Response
)
{
func
handlePostRPC
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
pi
Response
)
{
var
err
error
// Get Git action from URL
...
...
lfs.go
View file @
ffa068f5
...
...
@@ -18,7 +18,7 @@ import (
)
func
(
api
*
API
)
lfsAuthorizeHandler
(
handleFunc
serviceHandleFunc
)
httpHandleFunc
{
return
api
.
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
uthorization
Response
)
{
return
api
.
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
pi
Response
)
{
if
a
.
StoreLFSPath
==
""
{
fail500
(
w
,
errors
.
New
(
"lfsAuthorizeHandler: StoreLFSPath empty"
))
...
...
@@ -39,7 +39,7 @@ func (api *API) lfsAuthorizeHandler(handleFunc serviceHandleFunc) httpHandleFunc
},
"/authorize"
)
}
func
(
u
*
upstream
)
handleStoreLfsObject
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
uthorization
Response
)
{
func
(
u
*
upstream
)
handleStoreLfsObject
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
a
pi
Response
)
{
file
,
err
:=
ioutil
.
TempFile
(
a
.
StoreLFSPath
,
a
.
LfsOid
)
if
err
!=
nil
{
fail500
(
w
,
fmt
.
Errorf
(
"handleStoreLfsObject: create tempfile: %v"
,
err
))
...
...
main_test.go
View file @
ffa068f5
...
...
@@ -340,7 +340,7 @@ func runOrFail(t *testing.T, cmd *exec.Cmd) {
}
func
gitOkBody
(
t
*
testing
.
T
)
interface
{}
{
return
&
a
uthorization
Response
{
return
&
a
pi
Response
{
GL_ID
:
"user-123"
,
RepoPath
:
repoPath
(
t
),
}
...
...
@@ -353,7 +353,7 @@ func archiveOkBody(t *testing.T, archiveName string) interface{} {
}
archivePath
:=
path
.
Join
(
cwd
,
cacheDir
,
archiveName
)
return
&
a
uthorization
Response
{
return
&
a
pi
Response
{
RepoPath
:
repoPath
(
t
),
ArchivePath
:
archivePath
,
CommitId
:
"c7fbe50c7c7419d9701eebe64b1fdacc3df5b9dd"
,
...
...
upstream.go
View file @
ffa068f5
...
...
@@ -15,7 +15,7 @@ import (
"strings"
)
type
serviceHandleFunc
func
(
http
.
ResponseWriter
,
*
http
.
Request
,
*
a
uthorization
Response
)
type
serviceHandleFunc
func
(
http
.
ResponseWriter
,
*
http
.
Request
,
*
a
pi
Response
)
type
API
struct
{
*
http
.
Client
...
...
@@ -29,7 +29,7 @@ type upstream struct {
relativeURLRoot
string
}
type
a
uthorization
Response
struct
{
type
a
pi
Response
struct
{
// GL_ID is an environment variable used by gitlab-shell hooks during 'git
// push' and 'git pull'
GL_ID
string
...
...
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