Holger Weiss
ce64f79b63
mod_http_upload: Fix logging of file size mismatch
2016-01-11 23:50:15 +01:00
Holger Weiss
ddf70d60df
mod_http_upload: Return error atoms, not strings
...
Don't convert error atoms to strings before actually logging them. This
avoids a bogus error message when a user who has no uploaded files is
removed.
2016-01-11 23:50:15 +01:00
Holger Weiss
f2f8fe25f7
mod_http_upload: Log message if URL looks wrong
...
Log an [info] message if a PUT request looks like the specified
"put_url" contains a path component that doesn't match the
"request_handlers" path, as in the following configuration:
listen:
-
module: ejabberd_http
port: 5444
request_handlers:
"/": mod_http_upload
modules:
mod_http_upload:
put_url: "http://example.com/path/ "
2016-01-11 23:50:15 +01:00
Holger Weiss
ea4964dccd
mod_http_upload: Make case indentation consistent
...
Use four spaces (or the corresponding amount of tab characters) for case
indentation everywhere in mod_http_upload and mod_http_upload_quota.
2016-01-11 23:50:15 +01:00
Holger Weiss
0a24936e92
mod_http_upload: Apply cosmetic changes
2016-01-11 23:50:14 +01:00
Holger Weiss
0cfd521b7a
mod_http_upload: Don't flatten command strings
2016-01-11 23:50:14 +01:00
Holger Weiss
8c470c6a01
mod_http_upload: Don't let identify/1 return error
...
Let identify/1 return 'pass' when it failed to identify the file type,
as this doesn't (necessarily) indicate an error condition. This also
makes it consistent with the return value of convert/2.
2016-01-11 23:50:14 +01:00
Holger Weiss
1ee63657ac
mod_http_upload: Don't complain during shutdown
...
Ignore the case where, for some reason, no process is found to be
stopped.
Closes #810 .
2016-01-11 23:50:14 +01:00
Holger Weiss
9cd4e405c8
mod_http_upload: Use binary strings in most places
...
Switch to binary strings to fix a type issue, and for consistency.
2016-01-11 23:50:12 +01:00
Holger Weiss
5359525d3c
mod_http_upload: Check availability of ImageMagick
...
Log an error message during startup if the thumbnail option is enabled
but ImageMagick is not installed.
2016-01-11 23:50:12 +01:00
Holger Weiss
d46ee127e7
mod_http_upload: Suppress error on non-image files
...
Don't log an error (but only a debug) message if ImageMagick fails to
indentify the file type for thumbnail creation. The image might be
encrypted, or it could be a non-image file.
2016-01-11 23:50:12 +01:00
Holger Weiss
0b4e0e720e
mod_http_upload: Fix string()/binary() type issue
2016-01-11 23:50:12 +01:00
Holger Weiss
08f7291a24
mod_http_upload: Add/fix function specifications
2016-01-11 23:50:12 +01:00
Holger Weiss
d29795fb24
mod_http_upload: Strip newline from command output
...
The list_to_integer/1 function doesn't cope with trailing newline
characters.
2016-01-11 23:50:12 +01:00
Holger Weiss
f6b66cd130
mod_http_upload: Support thumbnail generation
...
Import thumbnail support from the mod_http_upload version shipped with
ejabberd.
2016-01-11 23:50:03 +01:00
Holger Weiss
1ee52e2e42
mod_http_upload: Fix function specification
2015-10-26 22:39:58 +01:00
Holger Weiss
1ff5cbc467
mod_http_upload: Log descriptive error messages
...
Let file:format_error/1 translate error reasons into descriptive
strings.
2015-10-25 00:21:31 +02:00
Holger Weiss
4936e82bd1
mod_http_upload: Fix error message format string
...
The store_file/4 function might return non-string error information.
2015-10-25 00:18:11 +02:00
Holger Weiss
c37387984a
mod_http_upload: Apply minor cosmetic changes
2015-10-22 22:50:39 +02:00
Holger Weiss
7c61eef522
mod_http_upload: Add support for user quotas
...
The new mod_http_upload_quota module implements two features:
- When a "hard quota" is exceeded during a file upload, old files are
removed until the disk usage equals or falls below the "soft quota".
- Once a day, all uploaded files (and directories) older than a
configurable number of days are deleted.
2015-10-22 21:52:13 +02:00
Holger Weiss
8a849069ec
mod_http_upload: Add slot request hook
...
Let mod_http_upload run an 'http_upload_slot_request' hook. If 'deny'
or an error element is returned, the request is rejected; if 'allow' is
returned, it is accepted.
2015-10-22 18:29:19 +02:00
Holger Weiss
14c3b13a11
mod_http_upload: Increase the upload slot timeout
...
If a large file was uploaded over a slow connection, the slot might've
timed out before the upload was completed.
2015-10-21 23:25:30 +02:00
Holger Weiss
6dc35e8fcb
mod_http_upload: Fix function specification
...
The mod_opt_type/1 function can return the list of option names.
2015-10-13 22:49:46 +02:00
Holger Weiss
a1fe316565
mod_http_upload: Update function specification
...
The handle_call/3 function now responds to some requests.
2015-10-01 00:57:41 +02:00
Holger Weiss
a36515d74d
mod_http_upload: Also start 'asn1' application
...
If an HTTPS service_url is specified, start the 'asn1' application as
well, as 'public_key' depends on it.
Once mod_http_upload requires Erlang/OTP R16B02 or newer, we can use the
following calls instead:
{ok, _} = application:ensure_all_started(inets),
{ok, _} = application:ensure_all_started(ssl).
2015-09-25 17:05:18 +02:00
Holger Weiss
de035cefff
mod_http_upload: Correct error message
2015-09-25 13:29:07 +02:00
Holger Weiss
6ca6f021cc
mod_http_upload: Handle HEAD and OPTIONS requests
2015-09-14 21:58:38 +02:00
Holger Weiss
a6c7dc9b8a
mod_http_upload: Set mode bits of all directories
...
When the "dir_mode" option is specified and the file root/a/b/file.png
is uploaded, make sure the permissions of the "a" directory are also
set.
2015-09-14 01:01:29 +02:00
Holger Weiss
f3bf402e7a
mod_http_upload: Stop correct process name
...
Make sure the stop/1 function uses the same process name as the start/2
function.
2015-09-14 00:49:31 +02:00
Holger Weiss
9eb68b4ef3
mod_http_upload: Add "custom_headers" option
...
The new "custom_headers" option allows admins to specify header fields
that are added to HTTP responses.
2015-08-31 22:24:52 +02:00
Holger Weiss
10092e3bd5
mod_http_upload: Use DEFAULT_CONTENT_TYPE macro
2015-08-31 20:08:55 +02:00
Holger Weiss
d45ec798ee
mod_http_upload: Make file/dir modes configurable
...
The new "file_mode" and "dir_mode" options allow admins to specify the
permission bits of files and directories created by mod_http_upload.
2015-08-31 20:06:22 +02:00
Holger Weiss
12274a2adc
mod_http_upload: Fix HTTP response matching
...
Fix the case where a service_url is specified and the service returns a
non-2xx status code.
2015-08-30 00:12:53 +02:00
Holger Weiss
19044ccb85
mod_http_upload: Support XEP-0363 namespace
2015-08-27 23:40:26 +02:00
Holger Weiss
06def469a4
mod_http_upload: Apply minor cosmetic changes
2015-08-27 21:56:09 +02:00
Holger Weiss
81e8404207
mod_http_upload: Support Erlang/OTP < R16B
2015-08-27 21:34:14 +02:00
Holger Weiss
11fc485a9c
mod_http_upload: Mention XEP number
...
The HTTP File Upload extension now has a number :-)
2015-08-27 18:35:10 +02:00
Holger Weiss
f7beaa3ef1
mod_http_upload: Cope with unexpected IQ stanzas
...
Don't stumble over IQ results and errors when an IQ request is expected.
2015-08-26 00:32:00 +02:00
Holger Weiss
a00090086e
mod_http_upload: Omit expansion for "service_url"
...
Don't expand the @HOST@ keyword within the "service_url" value, after
all. The code didn't cope with an undefined "service_url", and the
@HOST@ expansion probably isn't too useful there, anyway.
2015-08-23 19:37:09 +02:00
Holger Weiss
374c1b6dfc
mod_http_upload: Apply cosmetic changes
2015-08-23 18:06:12 +02:00
Holger Weiss
13e8c857ce
mod_http_upload: Change defaults
...
Change the default settings so that mod_http_upload should work out of
the box.
2015-08-23 17:58:26 +02:00
Holger Weiss
6db50940a1
mod_http_upload: Expand @HOME@ and @HOST@ keywords
...
Replace @HOST@ with the virtual host name if the keyword is specified
within the "put_url", "get_url", and/or "service_url" values. Also,
replace @HOME@ with the home directory of the user running ejabberd if
this keyword is specified within the "docroot" value.
2015-08-23 17:47:19 +02:00
Holger Weiss
f4950cdc83
mod_http_upload: Add "rm_on_unregister" option
...
The new "rm_on_unregister" option allows admins to specify whether files
uploaded by a user should be removed when that user is unregistered.
2015-08-23 17:22:32 +02:00
Holger Weiss
b9ece5c953
mod_http_upload: Apply cosmetic changes
2015-08-22 00:53:56 +02:00
Holger Weiss
a17a554a8c
mod_http_upload: Add "secret_length" option
...
The new "secret_length" option allows for specifying the length of the
random string included in the URLs generated by mod_http_upload.
2015-08-22 00:45:45 +02:00
Holger Weiss
216e244b6a
mod_http_upload: Add "jid_in_url" option
...
The new "jid_in_url" option allows for configuring the way the user's
JID is included in the URLs generated by mod_http_upload.
2015-08-21 23:22:48 +02:00
Holger Weiss
034a156066
Import mod_http_upload
...
Add a module that implements a new HTTP File Upload protocol.
2015-08-20 00:33:34 +02:00