Mercurial > public > mercurial-scm > hg
comparison mercurial/httpclient/tests/test_chunked_transfer.py @ 15218:c81dce8a7bb6
httpclient: update to 07d8c356f4d1 of py-nonblocking-http
This addresses a defect when the server closes the socket before
finishing a response (if it crashes, for example) first spotted in
Issue2951.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Mon, 10 Oct 2011 17:57:40 -0500 |
parents | a75e0f4ba0ab |
children | 24dbef11f477 |
comparison
equal
deleted
inserted
replaced
15217:42d0d4f63bf0 | 15218:c81dce8a7bb6 |
---|---|
132 chunkedblock('hi '), | 132 chunkedblock('hi '), |
133 ] + list(chunkedblock('there\n' * 5)) + [chunkedblock('')] | 133 ] + list(chunkedblock('there\n' * 5)) + [chunkedblock('')] |
134 con.request('GET', '/') | 134 con.request('GET', '/') |
135 self.assertStringEqual('hi there\nthere\nthere\nthere\nthere\n', | 135 self.assertStringEqual('hi there\nthere\nthere\nthere\nthere\n', |
136 con.getresponse().read()) | 136 con.getresponse().read()) |
137 | |
138 def testChunkedDownloadEarlyHangup(self): | |
139 con = http.HTTPConnection('1.2.3.4:80') | |
140 con._connect() | |
141 sock = con.sock | |
142 broken = chunkedblock('hi'*20)[:-1] | |
143 sock.data = ['HTTP/1.1 200 OK\r\n', | |
144 'Server: BogusServer 1.0\r\n', | |
145 'transfer-encoding: chunked', | |
146 '\r\n\r\n', | |
147 broken, | |
148 ] | |
149 sock.close_on_empty = True | |
150 con.request('GET', '/') | |
151 resp = con.getresponse() | |
152 self.assertRaises(http.HTTPRemoteClosedError, resp.read) | |
137 # no-check-code | 153 # no-check-code |