MCPcopy Index your code
hub / github.com/RustPython/RustPython / _read_headers

Function _read_headers

Lib/http/client.py:218–234  ·  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 _MAXHEADERS.

(fp)

Source from the content-addressed store, hash-verified

216 return lst
217
218def _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
236def _parse_header_lines(header_lines, _class=HTTPMessage):
237 """

Callers 3

parse_headersFunction · 0.85
beginMethod · 0.85
_tunnelMethod · 0.85

Calls 5

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

Tested by

no test coverage detected