File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 55
66
77# Operations we want to support:
8- # - find next \r\n or \r\n\r\n, or wait until there is one
8+ # - find next \r\n or \r\n\r\n (\n or \n\n are also acceptable),
9+ # or wait until there is one
910# - read at-most-N bytes
1011# Goals:
1112# - on average, do this fast
4041# processed a whole event, which could in theory be slightly more efficient
4142# than the internal bytearray support.)
4243
43- body_and_headers_delimiter_regex = re .compile (b"\n \r ?\n " , re .MULTILINE )
44+ blank_line_delimiter_regex = re .compile (b"\n \r ?\n " , re .MULTILINE )
4445line_delimiter_regex = re .compile (b"\r ?\n " , re .MULTILINE )
4546
4647
@@ -50,7 +51,8 @@ def __init__(self):
5051 # These are both absolute offsets into self._data:
5152 self ._start = 0
5253 self ._looked_at = 0
53- self ._looked_for_regex = body_and_headers_delimiter_regex
54+
55+ self ._looked_for_regex = blank_line_delimiter_regex
5456
5557 def __bool__ (self ):
5658 return bool (len (self ))
@@ -129,7 +131,7 @@ def maybe_extract_lines(self):
129131 self ._start += len (start_chunk )
130132 return []
131133 else :
132- data = self .maybe_extract_until_next (body_and_headers_delimiter_regex , 3 )
134+ data = self .maybe_extract_until_next (blank_line_delimiter_regex , 3 )
133135 if data is None :
134136 return None
135137
You can’t perform that action at this time.
0 commit comments