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
451b74af
Commit
451b74af
authored
Dec 02, 2015
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e2d44377
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
blob.go
blob.go
+3
-4
No files found.
blob.go
View file @
451b74af
...
@@ -284,8 +284,7 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
...
@@ -284,8 +284,7 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
// Blob not found -> 404
// Blob not found -> 404
if
sha1
==
""
{
if
sha1
==
""
{
// XXX -> 404
http
.
Error
(
w
,
fmt
.
Sprintf
(
"Blob for %v not found"
,
refpath
),
http
.
StatusNotFound
)
fail400
(
w
,
fmt
.
Sprintf
(
"Blob for %v not found"
,
refpath
),
nil
)
return
return
}
}
...
@@ -295,12 +294,12 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
...
@@ -295,12 +294,12 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
w
.
Header
()
.
Set
(
"Content-Length"
,
fmt
.
Sprintf
(
"%d"
,
size
))
w
.
Header
()
.
Set
(
"Content-Length"
,
fmt
.
Sprintf
(
"%d"
,
size
))
w
.
Header
()
.
Set
(
"X-Content-Type-Options"
,
"nosniff"
)
w
.
Header
()
.
Set
(
"X-Content-Type-Options"
,
"nosniff"
)
// net/http sniffs stream and and automatically detects and sets
// net/http sniffs stream and and automatically detects and sets
// Content-Type header. We do not have to do it ourselves
// Content-Type header. We do not have to do it ourselves
.
w
.
Header
()
.
Set
(
"Cache-Control"
,
"private"
)
// Rails sets this for IE compatibility
w
.
Header
()
.
Set
(
"Cache-Control"
,
"private"
)
// Rails sets this for IE compatibility
w
.
Header
()
.
Set
(
"ETag"
,
fmt
.
Sprintf
(
`"%s"`
,
sha1
))
w
.
Header
()
.
Set
(
"ETag"
,
fmt
.
Sprintf
(
`"%s"`
,
sha1
))
w
.
WriteHeader
(
200
)
// Don't bother with HTTP 500 from this point on, just return
w
.
WriteHeader
(
http
.
StatusOK
)
// Don't bother with HTTP 500 from this point on, just return
// XXX better use queryStdout instead of queryReader, but we could be
// XXX better use queryStdout instead of queryReader, but we could be
// holding some tail bytes in queryReader after chat phase
// holding some tail bytes in queryReader after chat phase
_
,
err
=
io
.
CopyN
(
w
,
queryReader
,
size
)
_
,
err
=
io
.
CopyN
(
w
,
queryReader
,
size
)
...
...
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