Software /
code /
prosody
Comparison
plugins/mod_net_multiplex.lua @ 11023:a59b37b03eca
mod_net_multiplex: Read no more than the max buffer size setting
Otherwise the '*a' read mode applies, which under certain circumstances
can read infinite amounts of data into memory.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 02 Aug 2020 00:22:57 +0200 |
parent | 10475:fa0cad7c89e3 |
child | 11024:1c7602c70d1f |
comparison
equal
deleted
inserted
replaced
11022:3e5bc34be734 | 11023:a59b37b03eca |
---|---|
39 end | 39 end |
40 end | 40 end |
41 | 41 |
42 local buffers = {}; | 42 local buffers = {}; |
43 | 43 |
44 local listener = { default_mode = "*a" }; | 44 local listener = { default_mode = max_buffer_len }; |
45 | 45 |
46 function listener.onconnect(conn) | 46 function listener.onconnect(conn) |
47 local sock = conn:socket(); | 47 local sock = conn:socket(); |
48 if sock.getalpn then | 48 if sock.getalpn then |
49 local selected_proto = sock:getalpn(); | 49 local selected_proto = sock:getalpn(); |