Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-05-14 19:30:21 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-05-14 19:39:58 +0300
commit063737e4f5158a52abde4388fa51a6a68ddcae51 (patch)
treeb28bd10ed7bf80adc3264669cf1c2777510ee8cb /include
parentcb3bb710bd11ee721a044eecfbf5436d563bf449 (diff)
Optimize HTTP requests memory usage
Due to historical reasons, ejabberd loads the whole file/data into the memory when serving an HTTP request. This is now improved: 1) For GET requests ejabberd uses sendfile(2) if the underlying connection is HTTP and falls back to read/write loop with 64kb buffer for HTTPS connections. This type of requests are handled by mod_http_fileserver, mod_http_upload, ejabberd_captcha, etc 2) POST requests are now limited to 20Mb and are fully downloaded into the memory for further processing (by ejabberd_web_admin, mod_bosh, etc) 3) PUT requests (e.g. for mod_http_upload) are handled by read/write loop with 64kb buffer
Diffstat (limited to 'include')
-rw-r--r--include/ejabberd_http.hrl5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/ejabberd_http.hrl b/include/ejabberd_http.hrl
index 3c38969ca..e0183a531 100644
--- a/include/ejabberd_http.hrl
+++ b/include/ejabberd_http.hrl
@@ -31,7 +31,10 @@
port = 5280 :: inet:port_number(),
opts = [] :: list(),
tp = http :: protocol(),
- headers = [] :: [{atom() | binary(), binary()}]}).
+ headers = [] :: [{atom() | binary(), binary()}],
+ length = 0 :: non_neg_integer(),
+ sockmod :: gen_tcp | fast_tls,
+ socket :: inet:socket() | fast_tls:tls_socket()}).
-record(ws,
{socket :: inet:socket() | fast_tls:tls_socket(),