Reads potential header lines into a list from a file pointer. Length of line is limited by _MAXLINE, and number of headers is limited by _MAXHEADERS.
(fp)
| 216 | return lst |
| 217 | |
| 218 | def _read_headers(fp): |
| 219 | """Reads potential header lines into a list from a file pointer. |
| 220 | |
| 221 | Length of line is limited by _MAXLINE, and number of |
| 222 | headers is limited by _MAXHEADERS. |
| 223 | """ |
| 224 | headers = [] |
| 225 | while True: |
| 226 | line = fp.readline(_MAXLINE + 1) |
| 227 | if len(line) > _MAXLINE: |
| 228 | raise LineTooLong("header line") |
| 229 | headers.append(line) |
| 230 | if len(headers) > _MAXHEADERS: |
| 231 | raise HTTPException("got more than %d headers" % _MAXHEADERS) |
| 232 | if line in (b'\r\n', b'\n', b''): |
| 233 | break |
| 234 | return headers |
| 235 | |
| 236 | def _parse_header_lines(header_lines, _class=HTTPMessage): |
| 237 | """ |
no test coverage detected