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
0ed2cd01
Commit
0ed2cd01
authored
Dec 09, 2015
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e5673020
Pipeline
#150
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
blob.go
blob.go
+5
-9
No files found.
blob.go
View file @
0ed2cd01
...
@@ -82,7 +82,6 @@ func (c *AuthCache) VerifyDownloadAccess(project string, query url.Values, heade
...
@@ -82,7 +82,6 @@ func (c *AuthCache) VerifyDownloadAccess(project string, query url.Values, heade
q
[
k
]
=
v
q
[
k
]
=
v
}
}
}
}
h
:=
url
.
Values
{}
h
:=
url
.
Values
{}
for
k
,
v
:=
range
header
{
for
k
,
v
:=
range
header
{
if
strings
.
HasSuffix
(
strings
.
ToUpper
(
k
),
"-TOKEN"
)
{
if
strings
.
HasSuffix
(
strings
.
ToUpper
(
k
),
"-TOKEN"
)
{
...
@@ -105,7 +104,7 @@ func (c *AuthCache) verifyDownloadAccess(key AuthCacheKey) AuthReply {
...
@@ -105,7 +104,7 @@ func (c *AuthCache) verifyDownloadAccess(key AuthCacheKey) AuthReply {
have_entry
:
have_entry
:
// entry in cache - use it
// entry in cache - use it
if
auth
!=
nil
{
if
auth
!=
nil
{
<-
auth
.
ready
//
make sure
it is ready
<-
auth
.
ready
//
wait untill
it is ready
auth
.
Lock
()
auth
.
Lock
()
auth
.
Nhit
++
auth
.
Nhit
++
...
@@ -192,7 +191,8 @@ func (c *AuthCache) askAuthBackend(key AuthCacheKey) AuthReply {
...
@@ -192,7 +191,8 @@ func (c *AuthCache) askAuthBackend(key AuthCacheKey) AuthReply {
// key.header -> url.Values -> http.Header
// key.header -> url.Values -> http.Header
hv
,
err
:=
url
.
ParseQuery
(
key
.
header
)
hv
,
err
:=
url
.
ParseQuery
(
key
.
header
)
if
err
!=
nil
{
if
err
!=
nil
{
// we prepared key.header ourselves via url-encoding in XXX. It must be ok
// we prepared key.header ourselves via url-encoding in AuthCache.VerifyDownloadAccess().
// It must be ok
panic
(
err
)
panic
(
err
)
}
}
header
:=
make
(
http
.
Header
)
header
:=
make
(
http
.
Header
)
...
@@ -248,10 +248,6 @@ func askAuthBackend(u *upstream, project, query string, header *http.Header) Aut
...
@@ -248,10 +248,6 @@ func askAuthBackend(u *upstream, project, query string, header *http.Header) Aut
return
authReply
return
authReply
}
}
func
verifyDownloadAccess
(
u
*
upstream
,
project
string
,
query
url
.
Values
,
header
http
.
Header
)
AuthReply
{
return
u
.
authCache
.
VerifyDownloadAccess
(
project
,
query
,
header
)
}
// HTTP handler for `.../raw/<ref>/path`
// HTTP handler for `.../raw/<ref>/path`
var
rawRe
=
regexp
.
MustCompile
(
`/raw/`
)
var
rawRe
=
regexp
.
MustCompile
(
`/raw/`
)
...
@@ -268,7 +264,7 @@ func handleGetBlobRaw(w http.ResponseWriter, r *gitRequest) {
...
@@ -268,7 +264,7 @@ func handleGetBlobRaw(w http.ResponseWriter, r *gitRequest) {
refpath
:=
u
.
Path
[
rawLoc
[
1
]
:
]
refpath
:=
u
.
Path
[
rawLoc
[
1
]
:
]
// Query download access auth for this project
// Query download access auth for this project
authReply
:=
verifyDownloadAccess
(
r
.
u
,
project
,
u
.
Query
(),
r
.
Request
.
Header
)
authReply
:=
r
.
u
.
authCache
.
VerifyDownloadAccess
(
project
,
u
.
Query
(),
r
.
Request
.
Header
)
if
authReply
.
RepoPath
==
""
{
if
authReply
.
RepoPath
==
""
{
// access denied - copy auth reply to client in full -
// access denied - copy auth reply to client in full -
// there are HTTP code and other headers / body relevant for
// there are HTTP code and other headers / body relevant for
...
@@ -388,7 +384,7 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
...
@@ -388,7 +384,7 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
return
return
}
}
// close git stdin explicitly, so it
exits
cleanly
// close git stdin explicitly, so it
can exit
cleanly
err
=
queryStdin
.
Close
()
err
=
queryStdin
.
Close
()
if
err
!=
nil
{
if
err
!=
nil
{
logError
(
fmt
.
Errorf
(
"queryStdin.Close: %v"
,
err
))
logError
(
fmt
.
Errorf
(
"queryStdin.Close: %v"
,
err
))
...
...
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