File tree 2 files changed +9
-0
lines changed
2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ The gzip transfer encoding is supported transparently.
9
9
See [ ` stream.connection ` ] ( #stream.connection )
10
10
11
11
12
+ ### ` h1_stream.max_header_lines ` <!-- --> {#http.h1_stream.max_header_lines}
13
+
14
+ The maximum number of header lines to read. Default is ` 100 ` .
15
+
16
+
12
17
### ` h1_stream:checktls() ` <!-- --> {#http.h1_stream: checktls }
13
18
14
19
See [ ` stream:checktls() ` ] ( #stream:checktls )
Original file line number Diff line number Diff line change 46
46
47
47
local stream_methods = {
48
48
use_zlib = has_zlib ;
49
+ max_header_lines = 100 ;
49
50
}
50
51
for k ,v in pairs (stream_common .methods ) do
51
52
stream_methods [k ] = v
@@ -321,6 +322,9 @@ function stream_methods:read_headers(timeout)
321
322
322
323
-- Use while loop for lua 5.1 compatibility
323
324
while true do
325
+ if headers :len () >= self .max_header_lines then
326
+ return nil , ce .strerror (ce .E2BIG ), ce .E2BIG
327
+ end
324
328
local k , v , errno = self .connection :read_header (0 )
325
329
if k == nil then
326
330
if v ~= nil then
You can’t perform that action at this time.
0 commit comments