mod_deflate
The mod_deflate module is designed to provide support for MODE Z commands, which allows FTP clients and servers to compress data for transfer.
MODE Z
This module is contained in the mod_deflate.c file for ProFTPD 1.3.x, and is not compiled by default. Installation instructions are discussed here. Detailed documentation on mod_deflate usage can be found here.
mod_deflate.c
The most current version of mod_deflate can be found at:
http://www.castaglia.org/proftpd/
Please contact TJ Saunders <tj at castaglia.org> with any questions, concerns, or suggestions regarding this module.
<VirtualHost>
<Global>
The DeflateEngine directive enables or disables the mod_deflate compression functionality. If set to on, then mod_deflate will advertise support for MODE Z compression via the FEAT command, and handle MODE Z requests appropriately.
DeflateEngine
FEAT
The DeflateLog directive is used to specify a log file for mod_deflate reporting and debugging. The path parameter must be the full path to the file to use for logging. Note that this path must not be to a world-writable directory and, unless AllowLogSymlinks is explicitly set to on (generally a bad idea), the path must not be a symbolic link.
DeflateLog
AllowLogSymlinks
If path is "none", no logging will be done at all.
$ ./configure --with-modules=mod_deflate
$ ./configure --enable-dso --with-shared=mod_deflate
$ make $ make install
For those with an existing ProFTPD installation, you can use the prxs tool to add mod_deflate, as a DSO module, to your existing server:
prxs
$ prxs -c -i -d mod_deflate.c
Example mod_deflate configuration:
<IfModule mod_deflate.c> DeflateEngine on DeflateLog /var/log/proftpd/deflate.log </IfModule>
Sites that run proftpd 1.3.0 should disable sendfile use when using mod_deflate, as the two features do not interoperate well:
proftpd
<IfModule mod_deflate.c> DeflateEngine on DeflateLog /var/log/proftpd/deflate.log UseSendfile off </IfModule>
Logging The mod_deflate module supports different forms of logging. The main module logging is done via the DeflateLog directive. For debugging purposes, the module also uses trace logging, via the module-specific log channels:
proftpd.conf
TraceLog /path/to/ftpd/trace.log Trace deflate:20
Frequently Asked Questions Question: I'm uploading a file using MODE Z, but the upload always fails. In the DeflateLog, I see: error inflating data: [-3] Data error What is going wrong? It is a mod_deflate bug? Answer: The most common cause of this error is when the client is trying to upload a binary file (e.g. PDF, MPG, etc) in ASCII mode. If MODE Z is not used in cases like this, the upload succeeds, but the uploaded file on the server is corrupted. When MODE Z is in effect, the corruption (translation of newlines inappropriately) is detected earlier (since mod_deflate can't uncompress the compressed data properly, hence the report of a "Data error"), and the upload fails. The solution is make sure that the client uploads (and downloads) non-ASCII files as binary files, not as ASCII files. © Copyright 2006-2017 TJ Saunders All Rights Reserved
Question: I'm uploading a file using MODE Z, but the upload always fails. In the DeflateLog, I see: error inflating data: [-3] Data error What is going wrong? It is a mod_deflate bug? Answer: The most common cause of this error is when the client is trying to upload a binary file (e.g. PDF, MPG, etc) in ASCII mode.
error inflating data: [-3] Data error
If MODE Z is not used in cases like this, the upload succeeds, but the uploaded file on the server is corrupted. When MODE Z is in effect, the corruption (translation of newlines inappropriately) is detected earlier (since mod_deflate can't uncompress the compressed data properly, hence the report of a "Data error"), and the upload fails.
The solution is make sure that the client uploads (and downloads) non-ASCII files as binary files, not as ASCII files.