aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/http
diff options
context:
space:
mode:
authorAntonio Navarro Perez <antnavper@gmail.com>2017-01-25 00:30:09 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-01-25 00:30:09 +0100
commitdc45de29f87a43078356a5be4c4b5aa24f626ee0 (patch)
treea36e94fedc5d82155c67857f8e8a8632fb15ff1e /plumbing/transport/http
parente549c1819773fd8ab302ecd1b7650c25aafaba43 (diff)
downloadgo-git-dc45de29f87a43078356a5be4c4b5aa24f626ee0.tar.gz
transport/http: fix partial request with haves. Fix #216. (#221)
Diffstat (limited to 'plumbing/transport/http')
-rw-r--r--plumbing/transport/http/upload_pack.go7
-rw-r--r--plumbing/transport/http/upload_pack_test.go2
2 files changed, 6 insertions, 3 deletions
diff --git a/plumbing/transport/http/upload_pack.go b/plumbing/transport/http/upload_pack.go
index e828857..fd1787c 100644
--- a/plumbing/transport/http/upload_pack.go
+++ b/plumbing/transport/http/upload_pack.go
@@ -171,10 +171,13 @@ func uploadPackRequestToReader(req *packp.UploadPackRequest) (*bytes.Buffer, err
return nil, fmt.Errorf("sending upload-req message: %s", err)
}
- if err := req.UploadHaves.Encode(buf); err != nil {
+ if err := req.UploadHaves.Encode(buf, false); err != nil {
return nil, fmt.Errorf("sending haves message: %s", err)
}
- _ = e.EncodeString("done\n")
+ if err := e.EncodeString("done\n"); err != nil {
+ return nil, err
+ }
+
return buf, nil
}
diff --git a/plumbing/transport/http/upload_pack_test.go b/plumbing/transport/http/upload_pack_test.go
index 13b7f75..a793efb 100644
--- a/plumbing/transport/http/upload_pack_test.go
+++ b/plumbing/transport/http/upload_pack_test.go
@@ -54,7 +54,7 @@ func (s *UploadPackSuite) TestuploadPackRequestToReader(c *C) {
c.Assert(string(b), Equals,
"0032want 2b41ef280fdb67a9b250678686a0c3e03b0a9989\n"+
"0032want d82f291cde9987322c8a0c81a325e1ba6159684c\n0000"+
- "0032have 6ecf0ef2c2dffb796033e5a02219af86ec6584e5\n0000"+
+ "0032have 6ecf0ef2c2dffb796033e5a02219af86ec6584e5\n"+
"0009done\n",
)
}