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
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-workhorse
Commits
9d938369
Commit
9d938369
authored
Jul 26, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Git line protocol into separate methods
parent
3aa51974
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
main.go
main.go
+14
-3
No files found.
main.go
View file @
9d938369
...
...
@@ -114,7 +114,12 @@ func handle_get_info_refs(user string, _ string, path string, w http.ResponseWri
w
.
Header
()
.
Add
(
"Content-Type"
,
fmt
.
Sprintf
(
"application/x-%s-advertisement"
,
rpc
))
no_cache
(
w
)
w
.
WriteHeader
(
200
)
fmt
.
Fprintf
(
w
,
"%s0000"
,
pkt_line
(
fmt
.
Sprintf
(
"# service=%s
\n
"
,
rpc
)))
if
err
:=
pkt_line
(
w
,
fmt
.
Sprintf
(
"# service=%s
\n
"
,
rpc
));
err
!=
nil
{
panic
(
err
)
}
if
err
:=
pkt_flush
(
w
);
err
!=
nil
{
panic
(
err
)
}
if
_
,
err
:=
io
.
Copy
(
w
,
stdout
);
err
!=
nil
{
panic
(
err
)
// No point in sending 500 to the client
}
...
...
@@ -177,8 +182,14 @@ func handle_post_rpc(user string, rpc string, path string, w http.ResponseWriter
}
}
func
pkt_line
(
s
string
)
string
{
return
fmt
.
Sprintf
(
"%04x%s"
,
len
(
s
)
+
4
,
s
)
func
pkt_line
(
w
io
.
Writer
,
s
string
)
error
{
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%04x%s"
,
len
(
s
)
+
4
,
s
)
return
err
}
func
pkt_flush
(
w
io
.
Writer
)
error
{
_
,
err
:=
fmt
.
Fprint
(
w
,
"0000"
)
return
err
}
func
fail_500
(
w
http
.
ResponseWriter
,
err
error
)
{
...
...
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