Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a6655446
Commit
a6655446
authored
Feb 01, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use some more constants
parent
a3fc1506
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
internal/senddata/sendfile.go
internal/senddata/sendfile.go
+9
-5
No files found.
internal/senddata/sendfile.go
View file @
a6655446
...
...
@@ -14,7 +14,10 @@ import (
"strings"
)
const
sendDataHeader
=
"Gitlab-Workhorse-Send-Data"
const
(
sendDataResponseHeader
=
"Gitlab-Workhorse-Send-Data"
sendFileResponseHeader
=
"X-Sendfile"
)
type
sendFileResponseWriter
struct
{
rw
http
.
ResponseWriter
...
...
@@ -28,6 +31,7 @@ func NewSendFileResponseWriter(rw http.ResponseWriter, req *http.Request) sendFi
rw
:
rw
,
req
:
req
,
}
// Advertise to upstream (Rails) that we support X-Sendfile
req
.
Header
.
Set
(
"X-Sendfile-Type"
,
"X-Sendfile"
)
return
s
}
...
...
@@ -57,8 +61,8 @@ func (s *sendFileResponseWriter) WriteHeader(status int) {
return
}
if
file
:=
s
.
Header
()
.
Get
(
"X-Sendfile"
);
file
!=
""
{
s
.
Header
()
.
Del
(
"X-Sendfile"
)
if
file
:=
s
.
Header
()
.
Get
(
sendFileResponseHeader
);
file
!=
""
{
s
.
Header
()
.
Del
(
sendFileResponseHeader
)
// Mark this connection as hijacked
s
.
hijacked
=
true
...
...
@@ -66,8 +70,8 @@ func (s *sendFileResponseWriter) WriteHeader(status int) {
sendFileFromDisk
(
s
.
rw
,
s
.
req
,
file
)
return
}
if
sendData
:=
s
.
Header
()
.
Get
(
sendDataHeader
);
strings
.
HasPrefix
(
sendData
,
git
.
SendBlobPrefix
)
{
s
.
Header
()
.
Del
(
sendDataHeader
)
if
sendData
:=
s
.
Header
()
.
Get
(
sendData
Response
Header
);
strings
.
HasPrefix
(
sendData
,
git
.
SendBlobPrefix
)
{
s
.
Header
()
.
Del
(
sendData
Response
Header
)
s
.
hijacked
=
true
git
.
SendBlob
(
s
.
rw
,
s
.
req
,
sendData
)
return
...
...
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