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
5be33684
Commit
5be33684
authored
Dec 02, 2015
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
238e32b9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
blob.go
blob.go
+15
-6
No files found.
blob.go
View file @
5be33684
...
...
@@ -135,10 +135,10 @@ func verifyDownloadAccess(w http.ResponseWriter, u *upstream, project string) (A
auth
,
ok
:=
authCache
[
project
]
if
ok
{
auth
.
Nhit
++
log
.
Printf
(
"authReply for %v cached ago: %v (hits: %v)"
,
project
,
time
.
Since
(
time
.
Unix
(
auth
.
Tauth
,
0
)),
auth
.
Nhit
)
//
log.Printf("authReply for %v cached ago: %v (hits: %v)",
//
project,
//
time.Since(time.Unix(auth.Tauth, 0)),
//
auth.Nhit)
return
auth
.
AuthReply
,
nil
}
...
...
@@ -246,7 +246,7 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
for
i
:=
len
(
refpathv
);
i
>
0
;
i
--
{
ref
:=
strings
.
Join
(
refpathv
[
:
i
],
"/"
)
path
:=
strings
.
Join
(
refpathv
[
i
:
],
"/"
)
log
.
Printf
(
"Trying %v %v"
,
ref
,
path
)
//
log.Printf("Trying %v %v", ref, path)
_
,
err
:=
fmt
.
Fprintf
(
queryStdin
,
"%s:%s
\n
"
,
ref
,
path
)
if
err
!=
nil
{
fail500
(
w
,
"git cat-file --batch; write"
,
err
)
...
...
@@ -259,7 +259,7 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
return
}
log
.
Printf
(
"<- %s"
,
reply
)
//
log.Printf("<- %s", reply)
// <object> SP missing LF
if
strings
.
HasSuffix
(
reply
,
" missing
\n
"
)
{
...
...
@@ -290,6 +290,15 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
}
// Blob found - start writing response
w
.
Header
()
.
Set
(
"Content-Disposition"
,
"inline"
)
w
.
Header
()
.
Set
(
"Content-Transfer-Encoding"
,
"binary"
)
w
.
Header
()
.
Set
(
"Content-Length"
,
fmt
.
Sprintf
(
"%d"
,
size
))
w
.
Header
()
.
Set
(
"X-Content-Type-Options"
,
"nosniff"
)
//w.Header().Set("Content-Type", "...") TODO image/jpeg...
w
.
Header
()
.
Set
(
"Cache-Control"
,
"private"
)
// Rails sets this for IE compatibility
w
.
Header
()
.
Set
(
"ETag"
,
fmt
.
Sprintf
(
`"%s"`
,
sha1
))
//setRawHeaders(...) // TODO
w
.
WriteHeader
(
200
)
// Don't bother with HTTP 500 from this point on, just return
// XXX better use queryStdout instead of queryReader, but we could be
...
...
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