File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 5
5
6
6
7
7
# 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
9
10
# - read at-most-N bytes
10
11
# Goals:
11
12
# - on average, do this fast
40
41
# processed a whole event, which could in theory be slightly more efficient
41
42
# than the internal bytearray support.)
42
43
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 )
44
45
line_delimiter_regex = re .compile (b"\r ?\n " , re .MULTILINE )
45
46
46
47
@@ -50,7 +51,8 @@ def __init__(self):
50
51
# These are both absolute offsets into self._data:
51
52
self ._start = 0
52
53
self ._looked_at = 0
53
- self ._looked_for_regex = body_and_headers_delimiter_regex
54
+
55
+ self ._looked_for_regex = blank_line_delimiter_regex
54
56
55
57
def __bool__ (self ):
56
58
return bool (len (self ))
@@ -129,7 +131,7 @@ def maybe_extract_lines(self):
129
131
self ._start += len (start_chunk )
130
132
return []
131
133
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 )
133
135
if data is None :
134
136
return None
135
137
You can’t perform that action at this time.
0 commit comments