| 1405 | # but most ASCII characters should be treated as already encoded |
| 1406 | class Handler(urllib.request.HTTPHandler): |
| 1407 | def http_open(self, req): |
| 1408 | result = self.do_open(self.connection, req) |
| 1409 | self.last_buf = self.connection.buf |
| 1410 | # Set up a normal response for the next request |
| 1411 | self.connection = test_urllib.fakehttp( |
| 1412 | b'HTTP/1.1 200 OK\r\n' |
| 1413 | b'Content-Length: 3\r\n' |
| 1414 | b'\r\n' |
| 1415 | b'123' |
| 1416 | ) |
| 1417 | return result |
| 1418 | handler = Handler() |
| 1419 | opener = urllib.request.build_opener(handler) |
| 1420 | tests = ( |