| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>ProFTPD module mod_deflate</title> |
| 5 | </head> |
| 6 | |
| 7 | <body bgcolor=white> |
| 8 | |
| 9 | <hr> |
| 10 | <center> |
| 11 | <h2><b>ProFTPD module <code>mod_deflate</code></b></h2> |
| 12 | </center> |
| 13 | <hr><br> |
| 14 | |
| 15 | <p> |
| 16 | The <code>mod_deflate</code> module is designed to provide support for |
| 17 | <code>MODE Z</code> commands, which allows FTP clients and servers to |
| 18 | compress data for transfer. |
| 19 | |
| 20 | <p> |
| 21 | This module is contained in the <code>mod_deflate.c</code> file for |
| 22 | ProFTPD 1.3.<i>x</i>, and is not compiled by default. Installation instructions |
| 23 | are discussed <a href="#Installation">here</a>. Detailed documentation on |
| 24 | <code>mod_deflate</code> usage can be found <a href="#Usage">here</a>. |
| 25 | |
| 26 | <p> |
| 27 | The most current version of <code>mod_deflate</code> can be found at: |
| 28 | <pre> |
| 29 | <a href="http://www.castaglia.org/proftpd/">http://www.castaglia.org/proftpd/</a> |
| 30 | </pre> |
| 31 | |
| 32 | <h2>Author</h2> |
| 33 | <p> |
| 34 | Please contact TJ Saunders <tj <i>at</i> castaglia.org> with any |
| 35 | questions, concerns, or suggestions regarding this module. |
| 36 | |
| 37 | <h2>Directives</h2> |
| 38 | <ul> |
| 39 | <li><a href="#DeflateEngine">DeflateEngine</a> |
| 40 | <li><a href="#DeflateLog">DeflatefLog</a> |
| 41 | </ul> |
| 42 | |
| 43 | <p> |
| 44 | <hr> |
| 45 | <h3><a name="DeflateEngine">DeflateEngine</a></h3> |
| 46 | <strong>Syntax:</strong> DeflateEngine <em>on|off</em><br> |
| 47 | <strong>Default:</strong> off<br> |
| 48 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 49 | <strong>Module:</strong> mod_deflate<br> |
| 50 | <strong>Compatibility:</strong> 1.3.0rc1 and later |
| 51 | |
| 52 | <p> |
| 53 | The <code>DeflateEngine</code> directive enables or disables the |
| 54 | <code>mod_deflate</code> compression functionality. If set to <em>on</em>, |
| 55 | then <code>mod_deflate</code> will advertise support for <code>MODE Z</code> |
| 56 | compression via the <code>FEAT</code> command, and handle <code>MODE Z</code> |
| 57 | requests appropriately. |
| 58 | |
| 59 | <p> |
| 60 | <hr> |
| 61 | <h3><a name="DeflateLog">DeflateLog</a></h3> |
| 62 | <strong>Syntax:</strong> DeflateLog <em>path|"none"</em><br> |
| 63 | <strong>Default:</strong> None<br> |
| 64 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 65 | <strong>Module:</strong> mod_deflate<br> |
| 66 | <strong>Compatibility:</strong> 1.3.0rc1 and later |
| 67 | |
| 68 | <p> |
| 69 | The <code>DeflateLog</code> directive is used to specify a log file for |
| 70 | <code>mod_deflate</code> reporting and debugging. The <em>path</em> parameter |
| 71 | must be the full path to the file to use for logging. Note that this path must |
| 72 | <b>not</b> be to a world-writable directory and, unless |
| 73 | <code>AllowLogSymlinks</code> is explicitly set to <em>on</em> |
| 74 | (generally a bad idea), the path must <b>not</b> be a symbolic link. |
| 75 | |
| 76 | <p> |
| 77 | If <em>path</em> is "none", no logging will be done at all. |
| 78 | |
| 79 | <p> |
| 80 | <hr> |
| 81 | <h2><a name="Installation">Installation</a></h2> |
| 82 | The <code>mod_deflate</code> module is distributed with ProFTPD. Follow the |
| 83 | usual steps for using third-party modules in ProFTPD: |
| 84 | <pre> |
| 85 | $ ./configure --with-modules=mod_deflate |
| 86 | </pre> |
| 87 | To build <code>mod_deflate</code> as a DSO module: |
| 88 | <pre> |
| 89 | $ ./configure --enable-dso --with-shared=mod_deflate |
| 90 | </pre> |
| 91 | Then follow the usual steps: |
| 92 | <pre> |
| 93 | $ make |
| 94 | $ make install |
| 95 | </pre> |
| 96 | |
| 97 | <p> |
| 98 | For those with an existing ProFTPD installation, you can use the |
| 99 | <code>prxs</code> tool to add <code>mod_deflate</code>, as a DSO module, to |
| 100 | your existing server: |
| 101 | <pre> |
| 102 | $ prxs -c -i -d mod_deflate.c |
| 103 | </pre> |
| 104 | |
| 105 | <p> |
| 106 | <hr> |
| 107 | <h2><a name="Usage">Usage</a></h2> |
| 108 | |
| 109 | <p> |
| 110 | Example <code>mod_deflate</code> configuration: |
| 111 | <pre> |
| 112 | <IfModule mod_deflate.c> |
| 113 | DeflateEngine on |
| 114 | DeflateLog /var/log/proftpd/deflate.log |
| 115 | </IfModule> |
| 116 | </pre> |
| 117 | |
| 118 | <p> |
| 119 | Sites that run <code>proftpd</code> 1.3.0 should disable sendfile use |
| 120 | when using <code>mod_deflate</code>, as the two features do not interoperate |
| 121 | well: |
| 122 | <pre> |
| 123 | <IfModule mod_deflate.c> |
| 124 | DeflateEngine on |
| 125 | DeflateLog /var/log/proftpd/deflate.log |
| 126 | |
| 127 | UseSendfile off |
| 128 | </IfModule> |
| 129 | </pre> |
| 130 | |
| 131 | <p> |
| 132 | <b>Logging</b><br> |
| 133 | The <code>mod_deflate</code> module supports different forms of logging. The |
| 134 | main module logging is done via the <code>DeflateLog</code> directive. |
| 135 | For debugging purposes, the module also uses <a href="../howto/Tracing.html">trace logging</a>, via the module-specific log channels: |
| 136 | <ul> |
| 137 | <li>deflate |
| 138 | </ul> |
| 139 | Thus for trace logging, to aid in debugging, you would use the following in |
| 140 | your <code>proftpd.conf</code>: |
| 141 | <pre> |
| 142 | TraceLog /path/to/ftpd/trace.log |
| 143 | Trace deflate:20 |
| 144 | </pre> |
| 145 | This trace logging can generate large files; it is intended for debugging use |
| 146 | only, and should be removed from any production configuration. |
| 147 | |
| 148 | <p><a name="FAQ"> |
| 149 | <b>Frequently Asked Questions</b><br> |
| 150 | |
| 151 | <p><a name="DeflateDataError"> |
| 152 | <font color=red>Question</font>: I'm uploading a file using <code>MODE Z</code>, |
| 153 | but the upload always fails. In the <code>DeflateLog</code>, I see: |
| 154 | <pre> |
| 155 | error inflating data: [-3] Data error |
| 156 | </pre> |
| 157 | What is going wrong? It is a <code>mod_deflate</code> bug?<br> |
| 158 | <font color=blue>Answer</font>: The most common cause of this error is when |
| 159 | the client is trying to upload a binary file (<i>e.g.</i> PDF, MPG, <i>etc</i>) |
| 160 | in <a href="http://www.proftpd.org/docs/howto/ASCII.html">ASCII</a> mode. |
| 161 | |
| 162 | <p> |
| 163 | If <code>MODE Z</code> is not used in cases like this, the upload succeeds, |
| 164 | but the uploaded file on the server is corrupted. When <code>MODE Z</code> |
| 165 | is in effect, the corruption (translation of newlines inappropriately) is |
| 166 | detected earlier (since <code>mod_deflate</code> can't uncompress the |
| 167 | compressed data properly, hence the report of a "Data error"), and the |
| 168 | upload fails. |
| 169 | |
| 170 | <p> |
| 171 | The solution is make sure that the client uploads (and downloads) non-ASCII |
| 172 | files as binary files, not as ASCII files. |
| 173 | |
| 174 | <p> |
| 175 | <hr> |
| 176 | <font size=2><b><i> |
| 177 | © Copyright 2006-2017 TJ Saunders<br> |
| 178 | All Rights Reserved<br> |
| 179 | </i></b></font> |
| 180 | <hr> |
| 181 | |
| 182 | </body> |
| 183 | </html> |