| 187 | raise AssertionError("Read after body finished: %r" % data) |
| 188 | |
| 189 | def match_readline(self, req, body, sizes): |
| 190 | data = self.szread(req.body.readline, sizes) |
| 191 | count = 1000 |
| 192 | while body: |
| 193 | if body[:len(data)] != data: |
| 194 | raise AssertionError("Invalid data read: %r" % data) |
| 195 | if b'\n' in data[:-1]: |
| 196 | raise AssertionError("Embedded new line: %r" % data) |
| 197 | body = body[len(data):] |
| 198 | data = self.szread(req.body.readline, sizes) |
| 199 | if not data: |
| 200 | count -= 1 |
| 201 | if count <= 0: |
| 202 | raise AssertionError("Apparent unexpected EOF") |
| 203 | if body: |
| 204 | raise AssertionError("Failed to read entire body: %r" % body) |
| 205 | elif data: |
| 206 | raise AssertionError("Read beyond expected body: %r" % data) |
| 207 | data = req.body.readline(sizes()) |
| 208 | if data: |
| 209 | raise AssertionError("Read data after body finished: %r" % data) |
| 210 | |
| 211 | def match_readlines(self, req, body, sizes): |
| 212 | """\ |