Merge lp:~axwalk/goose/close-response into lp:goose

Proposed by Andrew Wilkins on 2014-04-23
Status: Merged
Approved by: Andrew Wilkins on 2014-04-23
Approved revision: 117
Merged at revision: 119
Proposed branch: lp:~axwalk/goose/close-response
Merge into: lp:goose
Diff against target: 12 lines (+2/-0)
1 file modified
http/client.go (+2/-0)
To merge this branch: bzr merge lp:~axwalk/goose/close-response
Reviewer Review Type Date Requested Status
Juju Engineering 2014-04-23 Pending
Review via email: mp+216822@code.launchpad.net

Commit message

http: close response body if unused

BinaryRequest calls may discard the response
without closing it. This was causing sockets
to be left open in juju-core/provider/openstack
tests, leading to test failures.

https://codereview.appspot.com/90540043/

Description of the change

http: close response body if unused

BinaryRequest calls may discard the response
without closing it. This was causing sockets
to be left open in juju-core/provider/openstack
tests, leading to test failures.

https://codereview.appspot.com/90540043/

To post a comment you must log in.
Andrew Wilkins (axwalk) wrote :

Reviewers: mp+216822_code.launchpad.net,

Message:
Please take a look.

Description:
http: close response body if unused

BinaryRequest calls may discard the response
without closing it. This was causing sockets
to be left open in juju-core/provider/openstack
tests, leading to test failures.

https://code.launchpad.net/~axwalk/goose/close-response/+merge/216822

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/90540043/

Affected files (+4, -0 lines):
   A [revision details]
   M http/client.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20140124165235-h9rloooc531udms5
+New revision: <email address hidden>

Index: http/client.go
=== modified file 'http/client.go'
--- http/client.go 2013-10-18 01:52:13 +0000
+++ http/client.go 2014-04-23 06:57:55 +0000
@@ -180,6 +180,8 @@
   }
   if reqData.RespReader != nil {
    reqData.RespReader = respBody
+ } else {
+ respBody.Close()
   }
   return
  }

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'http/client.go'
2--- http/client.go 2013-10-18 01:52:13 +0000
3+++ http/client.go 2014-04-23 07:16:16 +0000
4@@ -180,6 +180,8 @@
5 }
6 if reqData.RespReader != nil {
7 reqData.RespReader = respBody
8+ } else {
9+ respBody.Close()
10 }
11 return
12 }

Subscribers

People subscribed via source and target branches