Merge lp:~jelmer/brz/readv-stats into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/readv-stats
Merge into: lp:brz
Diff against target: 43 lines (+11/-0)
3 files modified
breezy/tests/test_http.py (+2/-0)
breezy/transport/http/_urllib2_wrappers.py (+5/-0)
python3.passing (+4/-0)
To merge this branch: bzr merge lp:~jelmer/brz/readv-stats
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+353605@code.launchpad.net

Commit message

Fix byte counting for HTTP readv operations.

Description of the change

Fix byte counting for HTTP readv operations.

* Count bytes read through filesock.readinto
* Force reading of the last readv boundary line

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/tests/test_http.py'
2--- breezy/tests/test_http.py 2018-08-02 01:57:42 +0000
3+++ breezy/tests/test_http.py 2018-08-22 22:36:33 +0000
4@@ -2111,6 +2111,8 @@
5 # Remember that the request is ignored and that the ranges below
6 # doesn't have to match the canned response.
7 l = list(t.readv('/foo/bar', ((0, 255), (1000, 1050))))
8+ # Force consumption of the last bytesrange boundary
9+ t._get_connection().cleanup_pipe()
10 self.assertEqual(2, len(l))
11 self.assertActivitiesMatch()
12
13
14=== modified file 'breezy/transport/http/_urllib2_wrappers.py'
15--- breezy/transport/http/_urllib2_wrappers.py 2018-08-15 01:38:02 +0000
16+++ breezy/transport/http/_urllib2_wrappers.py 2018-08-22 22:36:33 +0000
17@@ -225,6 +225,11 @@
18 self.report_activity(len(s), 'read')
19 return s
20
21+ def readinto(self, b):
22+ s = self.filesock.readinto(b)
23+ self.report_activity(s, 'read')
24+ return s
25+
26 def __getattr__(self, name):
27 return getattr(self.filesock, name)
28
29
30=== modified file 'python3.passing'
31--- python3.passing 2018-08-22 00:34:58 +0000
32+++ python3.passing 2018-08-22 22:36:33 +0000
33@@ -25299,6 +25299,10 @@
34 breezy.tests.test_http.TestActivity.test_post(urllib,http,HTTP/1.1)
35 breezy.tests.test_http.TestActivity.test_post(urllib,https,HTTP/1.0)
36 breezy.tests.test_http.TestActivity.test_post(urllib,https,HTTP/1.1)
37+breezy.tests.test_http.TestActivity.test_readv(urllib,http,HTTP/1.0)
38+breezy.tests.test_http.TestActivity.test_readv(urllib,http,HTTP/1.1)
39+breezy.tests.test_http.TestActivity.test_readv(urllib,https,HTTP/1.0)
40+breezy.tests.test_http.TestActivity.test_readv(urllib,https,HTTP/1.1)
41 breezy.tests.test_http.TestAuthHeader.test_basic_extract_realm
42 breezy.tests.test_http.TestAuthHeader.test_basic_header
43 breezy.tests.test_http.TestAuthHeader.test_build_basic_header_with_long_creds

Subscribers

People subscribed via source and target branches