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

Method getallmatchingheaders

Lib/http/client.py:195–216  ·  view source on GitHub ↗

Find all header lines matching a given header name. Look through the list of headers and find all lines matching a given header name (and their continuation lines). A list of the lines is returned, without interpretation. If the header does not occur, an empty list

(self, name)

Source from the content-addressed store, hash-verified

193 # issues.
194
195 def getallmatchingheaders(self, name):
196 """Find all header lines matching a given header name.
197
198 Look through the list of headers and find all lines matching a given
199 header name (and their continuation lines). A list of the lines is
200 returned, without interpretation. If the header does not occur, an
201 empty list is returned. If the header occurs multiple times, all
202 occurrences are returned. Case is not important in the header name.
203
204 """
205 name = name.lower() + ':'
206 n = len(name)
207 lst = []
208 hit = 0
209 for line in self.keys():
210 if line[:n].lower() == name:
211 hit = 1
212 elif not line[:1].isspace():
213 hit = 0
214 if hit:
215 lst.append(line)
216 return lst
217
218def _read_headers(fp):
219 """Reads potential header lines into a list from a file pointer.

Callers

nothing calls this directly

Calls 5

lenFunction · 0.85
lowerMethod · 0.45
keysMethod · 0.45
isspaceMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected