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
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
Kazuhiko Shiozaki
gitlab-workhorse
Commits
dda7c98a
Commit
dda7c98a
authored
Oct 03, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close gzip readers
parent
8708f1dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
githandler.go
githandler.go
+12
-1
No files found.
githandler.go
View file @
dda7c98a
...
...
@@ -191,7 +191,7 @@ func handleGetInfoRefs(env gitEnv, _ string, path string, w http.ResponseWriter,
}
func
handlePostRPC
(
env
gitEnv
,
rpc
string
,
path
string
,
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
var
body
io
.
Reader
var
body
io
.
Read
Clos
er
var
err
error
// The client request body may have been gzipped.
...
...
@@ -204,6 +204,7 @@ func handlePostRPC(env gitEnv, rpc string, path string, w http.ResponseWriter, r
}
else
{
body
=
r
.
Body
}
defer
body
.
Close
()
// Prepare our Git subprocess
cmd
:=
gitCommand
(
env
,
"git"
,
subCommand
(
rpc
),
"--stateless-rpc"
,
path
)
...
...
@@ -230,12 +231,22 @@ func handlePostRPC(env gitEnv, rpc string, path string, w http.ResponseWriter, r
fail500
(
w
,
"handlePostRPC write to subprocess"
,
err
)
return
}
// Signal to the Git subprocess that no more data is coming
stdin
.
Close
()
// It may take a while before we return and the deferred closes happen
// so let's free up some resources already.
r
.
Body
.
Close
()
// If the body was compressed, body != r.Body and this frees up the
// gzip.Reader.
body
.
Close
()
// Start writing the response
w
.
Header
()
.
Add
(
"Content-Type"
,
fmt
.
Sprintf
(
"application/x-%s-result"
,
rpc
))
w
.
Header
()
.
Add
(
"Cache-Control"
,
"no-cache"
)
w
.
WriteHeader
(
200
)
// Don't bother with HTTP 500 from this point on, just return
// This io.Copy may take a long time, both for Git push and pull.
if
_
,
err
:=
io
.
Copy
(
w
,
stdout
);
err
!=
nil
{
logContext
(
"handlePostRPC read from subprocess"
,
err
)
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