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
bdde6205
Commit
bdde6205
authored
Oct 03, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small fixes
parent
17dd7cb7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
13 deletions
+8
-13
internal/git/git-http.go
internal/git/git-http.go
+1
-1
internal/git/pktline.go
internal/git/pktline.go
+2
-7
internal/git/pktline_test.go
internal/git/pktline_test.go
+5
-5
No files found.
internal/git/git-http.go
View file @
bdde6205
...
...
@@ -121,7 +121,7 @@ func handlePostRPC(w http.ResponseWriter, r *http.Request, a *api.Response) {
// either.
_
,
err
=
io
.
Copy
(
buffer
,
io
.
LimitReader
(
r
.
Body
,
4096
))
if
err
!=
nil
{
helper
.
Fail500
(
w
,
r
,
&
copyError
{
fmt
.
Errorf
(
"handlePostRPC: buffer git-upload-pack body: %v"
)})
helper
.
Fail500
(
w
,
r
,
&
copyError
{
fmt
.
Errorf
(
"handlePostRPC: buffer git-upload-pack body: %v"
,
err
)})
return
}
...
...
internal/git/pktline.go
View file @
bdde6205
...
...
@@ -34,14 +34,9 @@ func scanDeepen(body io.Reader) (bool, error) {
}
func
pktLineSplitter
(
data
[]
byte
,
atEOF
bool
)
(
advance
int
,
token
[]
byte
,
err
error
)
{
truncatedData
:=
data
if
len
(
data
)
>
100
{
truncatedData
=
truncatedData
[
:
100
]
}
if
len
(
data
)
<
4
{
if
atEOF
&&
len
(
data
)
>
0
{
return
0
,
nil
,
fmt
.
Errorf
(
"pktLineSplitter: incomplete length prefix on %q"
,
truncatedD
ata
)
return
0
,
nil
,
fmt
.
Errorf
(
"pktLineSplitter: incomplete length prefix on %q"
,
d
ata
)
}
return
0
,
nil
,
nil
// want more data
}
...
...
@@ -67,7 +62,7 @@ func pktLineSplitter(data []byte, atEOF bool) (advance int, token []byte, err er
if
len
(
data
)
<
pktLength
{
if
atEOF
{
return
0
,
nil
,
fmt
.
Errorf
(
"pktLineSplitter: less than %d bytes in input %q"
,
pktLength
,
truncatedD
ata
)
return
0
,
nil
,
fmt
.
Errorf
(
"pktLineSplitter: less than %d bytes in input %q"
,
pktLength
,
d
ata
)
}
return
0
,
nil
,
nil
// want more data
}
...
...
internal/git/pktline_test.go
View file @
bdde6205
...
...
@@ -16,13 +16,13 @@ func TestSuccessfulScanDeepen(t *testing.T) {
}
for
_
,
example
:=
range
examples
{
ok
,
err
:=
scanDeepen
(
bytes
.
NewReader
([]
byte
(
example
.
input
)))
hasDeepen
,
err
:=
scanDeepen
(
bytes
.
NewReader
([]
byte
(
example
.
input
)))
if
err
!=
nil
{
t
.
Fatalf
(
"error scanning %q: %v"
,
example
.
input
,
err
)
}
if
ok
!=
example
.
output
{
t
.
Fatalf
(
"scanDeepen %q: expected %v, got %v"
,
example
.
input
,
example
.
output
,
ok
)
if
hasDeepen
!=
example
.
output
{
t
.
Fatalf
(
"scanDeepen %q: expected %v, got %v"
,
example
.
input
,
example
.
output
,
hasDeepen
)
}
}
}
...
...
@@ -35,14 +35,14 @@ func TestFailedScanDeepen(t *testing.T) {
}
for
_
,
example
:=
range
examples
{
ok
,
err
:=
scanDeepen
(
bytes
.
NewReader
([]
byte
(
example
)))
hasDeepen
,
err
:=
scanDeepen
(
bytes
.
NewReader
([]
byte
(
example
)))
if
err
==
nil
{
t
.
Fatalf
(
"expected error scanning %q"
,
example
)
}
t
.
Log
(
err
)
if
ok
==
true
{
if
hasDeepen
==
true
{
t
.
Fatalf
(
"scanDeepen %q: expected result to be false, got true"
,
example
)
}
}
...
...
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