24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-04 21:27:16 +02:00
Commit Graph

89 Commits

Author SHA1 Message Date
Evgeniy Khramtsov
86236431b9 mod_http_upload: Treat file and network errors differently 2018-07-04 08:55:52 +03:00
Evgeniy Khramtsov
fface33d54 HTTP Upload: introduce new option 'external_secret'
The option makes it possible to offload all HTTP Upload processing
to a separate HTTP server. Both ejabberd and the HTTP server
should share this secret and behave exactly as described at
at https://modules.prosody.im/mod_http_upload_external.html
in the 'Implementation' section. Example configuration:

modules:
  ...
  mod_http_upload:
    ...
    put_url: "http://separate.http.server/upload"
    external_secret: "foo bar baz"
  ...
2018-07-02 16:53:44 +03:00
Evgeniy Khramtsov
66591b1c0d Improve URLs validation 2018-06-29 11:06:24 +03:00
Evgeniy Khramtsov
b094ce8ea5 HTTP Upload: increase gen_server call timeout 2018-06-29 10:32:53 +03:00
Evgeniy Khramtsov
9c82c2f6d0 HTTP Upload: put more info in log messages 2018-06-29 09:58:33 +03:00
Evgeniy Khramtsov
9a11db91f9 Use lists:foldl/3 2018-06-27 13:36:58 +03:00
Evgeniy Khramtsov
af8c6d2428 Generate HTTP Upload form using xdata codec 2018-06-27 13:29:38 +03:00
Evgeniy Khramtsov
881e02632b Improve error formatting in mod_http_upload 2018-06-26 19:32:29 +03:00
Evgeniy Khramtsov
fd8e07af47 Get rid of ejabberd.hrl header
The header consisted of too many unrelated stuff and macros misuse.
Some stuff is moved into scram.hrl and type_compat.hrl.
All macros have been replaced with the corresponding function calls.

TODO: probably type_compat.hrl is not even needed anymore since
we support only Erlang >= OTP 17.5
2018-06-14 14:00:47 +03:00
Holger Weiss
ba30ac8ce8 Return detailed error if HTTP upload is too large
If the file size specified in an HTTP upload slot request exceeds the
the configured maximum size, include the limit with the stanza error.
2018-06-04 22:18:56 +02:00
Evgeniy Khramtsov
b64e1d95d2 Fix typo file:read() -> file:open() 2018-05-17 12:00:06 +03:00
Evgeniy Khramtsov
063737e4f5 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
2018-05-14 19:39:58 +03:00
Evgeniy Khramtsov
c30715e67b Disable thumbnails creation by default 2018-05-11 18:56:31 +03:00
Holger Weiss
f3795e9d03 mod_http_upload: Add MIME type for M4A files 2018-04-24 18:16:16 +02:00
Holger Weiss
48c5ab59f1 mod_http_upload*: Remove empty lines after specs
Remove blank lines following function specifications in mod_http_upload
and mod_http_upload_quota for consistency with other modules.
2018-04-16 18:22:54 +02:00
Holger Weiss
b2855d63a7 mod_http_upload*: Add function specifications 2018-04-16 18:17:28 +02:00
Holger Weiss
e2652ce02f mod_http_upload: Accept characters of any script
Accept all alphanumeric characters of any script in user and file names
rather than replacing non-ASCII characters with underscores.  However,
non-alphanumeric characters are still replaced, except for "." and "-".

Closes #2346.
2018-04-03 21:00:15 +02:00
Holger Weiss
a2e1f5c882 Move ejabberd_http:url_encode/1 to 'misc' module 2018-04-03 00:12:43 +02:00
Marc Schink
c1e5ae5308 Move make_rand_string() to 'randoms' module 2018-02-23 18:32:34 +01:00
Evgeniy Khramtsov
ba2b650464 Introduce new gen_mod callback: mod_options/1
The callback is supposed to provide known options and their default
values, as long as the documentation. Passing default values into
get_mod functions is now deprecated: all defaults should be provided
by the Mod:mod_options/1 callback.
2018-01-23 10:54:52 +03:00
Evgeniy Khramtsov
d3aab2ea18 Get rid of a call to misc:have_eimp() 2018-01-15 13:14:51 +03:00
Evgeniy Khramtsov
0f86559d83 Always build eimp dependency
Even if no suitable C graphics libraries are detected
at compile time, the package is still usable because it
provides `eimp:get_type/1` which is used by mod_avatar.
2018-01-15 12:54:57 +03:00
Evgeniy Khramtsov
9d94361466 Process 'name' option for all route-registering modules
The option allows to set arbitrary text for disco#info identity name.
Previously, option 'name' was supported by mod_proxy65 and mod_http_upload
only. Now, all the following modules support this option as well:
- mod_disco
- mod_irc
- mod_muc
- mod_multicast
- mod_pubsub
- mod_vcard

Example:
```
modules:
  ...
  mod_disco:
    name: "Cool XMPP Server"
  ...
```
2018-01-08 11:29:17 +03:00
Evgeniy Khramtsov
cdc7c1d1ed Update copyright dates 2018-01-05 23:18:58 +03:00
Evgeniy Khramtsov
abc09054e5 Remove forgotten export_all 2017-09-27 11:56:22 +03:00
Holger Weiss
0cc1ae0a6a mod_http_upload: Don't ignore 'custom_headers'
Don't ignore the 'custom_headers' option if the domain part of the
'put_url' doesn't match the XMPP domain.

Closes #1482.
2017-09-26 21:40:56 +02:00
Evgeniy Khramtsov
3e987d3bae Use eimp instead of ImageMagick calls for thumbnails creation 2017-09-25 12:41:12 +03:00
Evgeniy Khramtsov
d7250111ce Reuse some translation strings 2017-09-24 14:32:37 +03:00
Evgeniy Khramtsov
6e20e9bcf9 Get rid of deprecated crypto functions 2017-08-17 19:32:15 +03:00
Evgeniy Khramtsov
3fec782494 Introduce 'hosts' option
The option can be used as a replacement of 'host' option
when several (sub)domains are needed to be registered for the module.
Note that you cannot combine both 'host' and 'hosts' in the config
because 'host' option is of a higher priority. Example:

mod_pubsub:
   ...
   hosts:
     - "pubsub1.@HOST@"
     - "pubsub2.@HOST@"

Fixes #1883
2017-08-08 17:46:26 +03:00
Evgeniy Khramtsov
fddd6110e0 Don't validate an option in gen_mod:get*opt() functions
The changes are very similar to those from previous commit:
* Now there is no need to pass validating function in
  gen_mod:get_opt() and gen_mod:get_module_opt() functions,
  because the modules' configuration keeps already validated values.
* New functions gen_mod:get_opt/2 and gen_mod:get_module_opt/3 are
  introduced.
* Functions gen_mod:get_opt/4 and get_module_opt/5 are deprecated.
  If the functions are still called, the "function" argument is
  simply ignored.
* Validating callback Mod:listen_opt_type/1 is introduced to validate
  listening options at startup.
2017-04-30 19:01:47 +03:00
Holger Weiss
168712ebbd Add support for HTTP File Upload, version 0.3.0
Support the current XEP-0363 version in addition to the previous
revisions.
2017-04-21 18:36:53 +02:00
Evgeniy Khramtsov
64333f69ea Don't try to load already loaded applications 2017-04-19 11:40:58 +03:00
Christophe Romain
b1acd1183f Rename aux.erl as misc.erl
Thanks Microsoft Windows to not support some filenames
2017-04-11 12:13:58 +02:00
Evgeniy Khramtsov
7bcbea2108 Deprecate jlib.erl in favor of aux.erl
Since the main goal of jlib.erl is lost, all auxiliary functions
are now moved to aux.erl, and the whole jlib.erl is now deprecated.
2017-03-30 14:17:13 +03:00
Holger Weiss
510fde58d8 mod_http_upload: Don't add "Server" header line
Administrators can add the "Server" header line using the new listener
option "custom_headers", if desired.
2017-03-28 00:03:17 +02:00
Holger Weiss
191fc1b4e8 ejabberd_http: Expand @VERSION@ in custom headers
Let ejabberd_http expand the @VERSION@ keyword to the ejabberd version
if specified in the "custom_headers" listener option.

Closes #1414.
2017-03-27 23:52:49 +02:00
Alexey Shchepin
069d28b1ed Get rid of p1_sha calls 2017-03-14 02:31:51 +03:00
Evgeniy Khramtsov
7decd58aaa Don't fail on elements decoding 2017-02-26 11:53:41 +03:00
Evgeniy Khramtsov
c1439ddd5b Get rid of jid:to_string/1 and jid:from_string/1 2017-02-26 10:07:12 +03:00
Evgeniy Khramtsov
603ec9cb19 Don't pass empty resource to jid:make() 2017-02-25 10:01:01 +03:00
Evgeniy Khramtsov
940ca9311d Fix some dialyzer warnings 2017-02-18 09:36:27 +03:00
Evgeniy Khramtsov
8b2d308498 Change routing API
Now 'From' and 'To' arguments must be omitted in functions
and structures related to routing.
The commit deprecates the following functions:
     ejabberd_router:route/3 in favor of ejabberd_router:route/1
     ejabberd_router:route_error/4 in favor of ejabberd_router:route_error/2
     ejabberd_local:route_iq/4 in favor of ejabberd_local:route_iq/2
     ejabberd_local:route_iq/5 in favor of ejabberd_local:route_iq/3
The format of {route, From, To, Packet} is changed in favor of {route, Packet}
2017-02-16 11:10:24 +03:00
Evgeniy Khramtsov
f61c933a7a Only use GEN_SERVER macro where appropriate 2017-02-14 15:39:57 +03:00
Evgeniy Khramtsov
28f66ddd7c Attach modules to gen_mod's supervisor 2017-02-14 12:39:26 +03:00
Evgeniy Khramtsov
d5d906184f Merge branch 'new_stream'
Conflicts:
	src/cyrsasl.erl
	src/ejabberd_c2s.erl
	src/ejabberd_cluster.erl
	src/ejabberd_frontend_socket.erl
	src/ejabberd_node_groups.erl
	src/ejabberd_router.erl
	src/mod_bosh.erl
	src/mod_ip_blacklist.erl
	src/mod_muc_mnesia.erl
	src/mod_offline.erl
	src/mod_proxy65_sm.erl
2017-01-20 19:35:46 +03:00
Evgeniy Khramtsov
0baaad30b1 Implement database backend interface for MUC, BOSH and auth_anonyous 2017-01-13 12:03:39 +03:00
Badlop
5fdd1c39fe Update copyright date automatically (#1442) 2017-01-02 21:42:06 +01:00
Evgeniy Khramtsov
56b30ab598 Improve translation of some messages 2016-11-26 10:05:22 +03:00
Badlop
c5e7b4738f Fix handling mod_http_upload disco#info queries: need decoded elements
As reported in
https://www.ejabberd.im/forum/28605/ejabberd-modhttpupload-error-405-not-allowed
2016-11-21 12:06:11 +01:00