File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -309,9 +309,12 @@ def begin(self):
309
309
if status != CONTINUE :
310
310
break
311
311
# skip the header from the 100 response
312
+ header_total_size = 0
312
313
while True :
313
314
skip = self .fp .readline (_MAXLINE + 1 )
314
- if len (skip ) > _MAXLINE :
315
+ line_length = len (skip )
316
+ header_total_size += line_length
317
+ if line_length > _MAXLINE or header_total_size > _MAXLINE :
315
318
raise LineTooLong ("header line" )
316
319
skip = skip .strip ()
317
320
if not skip :
Original file line number Diff line number Diff line change @@ -1180,6 +1180,14 @@ def test_overflowing_header_line(self):
1180
1180
resp = client .HTTPResponse (FakeSocket (body ))
1181
1181
self .assertRaises (client .LineTooLong , resp .begin )
1182
1182
1183
+ def test_overflowing_total_header_size_after_100 (self ):
1184
+ body = (
1185
+ 'HTTP/1.1 100 OK\r \n '
1186
+ 'r\n ' * 32768
1187
+ )
1188
+ resp = client .HTTPResponse (FakeSocket (body ))
1189
+ self .assertRaises (client .LineTooLong , resp .begin )
1190
+
1183
1191
def test_overflowing_chunked_line (self ):
1184
1192
body = (
1185
1193
'HTTP/1.1 200 OK\r \n '
You can’t perform that action at this time.
0 commit comments