MCPcopy Index your code
hub / github.com/python/cpython / _read_headers

Function _read_headers

Lib/http/client.py:217–235  ·  view source on GitHub ↗

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 max_headers.

(fp, max_headers)

Source from the content-addressed store, hash-verified

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

Callers 3

parse_headersFunction · 0.85
beginMethod · 0.85
_tunnelMethod · 0.85

Calls 4

LineTooLongClass · 0.85
HTTPExceptionClass · 0.85
readlineMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…