This file is indexed.

/usr/share/doc/libapache2-mod-xsendfile/Readme.html is in libapache2-mod-xsendfile 0.12-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
  <title>mod_xsendfile for Apache2/Apache2.2</title>
  <meta content="Nils Maier" name="author" />
  <style media="all" type="text/css">
body { width: 80ex;
font-family: sans-serif;
}
h1, h2, h3, h4, h5, h6 { padding: 0.3em 0.2em 0.3em 0.7em;
color: white;
font-size: larger;
background-color: rgb(85, 118, 151);
margin-bottom: 12pt;
margin-top: 8pt;
}
h1 { font-size: x-large;
background-color: rgb(64, 88, 113);
}
h3 { font-size: medium;
background-color: rgb(229, 236, 243);
color: rgb(102, 102, 102);
}
h4 { font-size: small;
}
p, li { margin-top: 4pt;
margin-bottom: 6pt;
}
.code { border: 1px solid gray;
padding: 2pt;
}
table.directive { text-align: left;
width: 100%;
}
.checksum {
	font-size: x-small;
}
  </style>
</head>
<body>

<h1>mod_xsendfile for Apache2/Apache2.2</h1>

<h2>Overview</h2>

<p>mod_xsendfile is a small Apache2 module that
processes&nbsp;X-SENDFILE headers registered by the original output
handler.</p>

<p>If it encounters the presence of such header it will discard
all output and send the file specified by that header instead using Apache internals
including all optimizations like caching-headers and sendfile or mmap if configured.</p>

<p>It is useful for processing script-output of e.g. php, perl or
any cgi.</p>

<h2>Useful?</h2>

<p>Yep, it is useful.</p>

<ul>

	<li>Some applications require checking for special privileges.</li>

	<li>Other have to lookup values first (e.g.. from a DB) in order to correctly process a download request.</li>

	<li>Or store values (download-counters come into mind).</li>

	<li>etc.</li>

</ul>

<h3>Benefits</h3>

<ul>

  <li>Uses apache internals</li>

  <li>Optimal delivery through sendfile and mmap (if available).</li>

  <li>Sets correct cache headers such as Etag and
If-Modified-Since as if the file was statically served.</li>

  <li>Processes cache headers such as If-None-Match or
If-Modified-Since.</li>

	<li>Support for ranges.</li>

</ul>

<h2>Download</h2>

<ul>
	<li><code><a href="mod_xsendfile.c#hash(sha256:d1a293e364626db25cc9d976b9dcc79d3dcdddff72d1f0084013695d611201b4)">mod_xsendfile.c</a></code><br/>
	<span class="checksum">SHA256: <code>d1a293e364626db25cc9d976b9dcc79d3dcdddff72d1f0084013695d611201b4</code></span></li>
	<li><code>Source tarball: <a href="mod_xsendfile-0.11.1.tar.gz#hash(sha256:145b15c5bd2bf0998fa30eef8ba42d8df94ba75709be8f127d5b2a74b4d2c4db)">mod_xsendfile-0.11.1.tar.gz</a></code><br/>
	<span class="checksum">SHA256: <code>145b15c5bd2bf0998fa30eef8ba42d8df94ba75709be8f127d5b2a74b4d2c4db</code></span></li>
	<li><code>Win32 binaries: <a href="mod_xsendfile-0.11.1.zip#hash(sha256:2148b6ba3d1b4909ee29431a6dbb7e5ce1e8b3528dd6432f1dccc56c6a528377)">mod_xsendfile-0.11.1.zip</a></code><br/>
	<span class="checksum">SHA256: <code>2148b6ba3d1b4909ee29431a6dbb7e5ce1e8b3528dd6432f1dccc56c6a528377</code></span></li>
	<li><code>GitHub repository: <a href="http://github.com/nmaier/mod_xsendfile">http://github.com/nmaier/mod_xsendfile</a></code></li>
</ul>

<h2>Installation</h2>
<ol>
  <li>Grab the source.</li>
  <li>Compile and install<br />
    <code>apxs -cia mod_xsendfile.c</code></li>
  <li>Restart apache</li>
  <li>That's all.</li>
</ol>

<h2>Configuration</h2>

<h3>XSendFile</h3>

<table class="code directive" border="0" cellpadding="2" cellspacing="0">
  <tbody>
    <tr>
      <th>Description</th>
      <td>Enables or disables header processing</td>
    </tr>
    <tr>
      <th>Syntax</th>
      <td>XSendFile on|off</td>
    </tr>
    <tr>
      <th>Default</th>
      <td>XSendFile off</td>
    </tr>
    <tr>
      <th>Context</th>
      <td>server config, virtual host, directory, .htaccess</td>
    </tr>
  </tbody>
</table>

<p>Setting <code>XSendFile on</code> will enable
processing.</p>

<p>The file specified in <code>X-SENDFILE</code>
header will be sent instead
of the handler output.</p>

<p>If the response lacks the <code>X-SENDFILE</code>
header nothing is done.
</p>

<h3>XSendFileIgnoreEtag</h3>

<table class="code directive" border="0" cellpadding="2" cellspacing="0">
  <tbody>
    <tr>
      <th>Description</th>
      <td>Ignore script provided Etag headers</td>
    </tr>
    <tr>
      <th>Syntax</th>
      <td>XSendFileIgnoreEtag on|off</td>
    </tr>
    <tr>
      <th>Default</th>
      <td>XSendFileIgnoreEtag off</td>
    </tr>
    <tr>
      <th>Context</th>
      <td>server config, virtual host, directory, .htaccess</td>
    </tr>
  </tbody>
</table>

<p>Setting <code>XSendFileIgnoreEtag on</code> will ignore all ETag headers the original output handler may have set.<br/>
This is helpful for applications that will generate such headers even for empty content.</p>

<h3>XSendFileIgnoreLastModified</h3>

<table class="code directive" border="0" cellpadding="2" cellspacing="0">
  <tbody>
    <tr>
      <th>Description</th>
      <td>Ignore script provided LastModified headers</td>
    </tr>
    <tr>
      <th>Syntax</th>
      <td>XSendFileIgnoreLastModified on|off</td>
    </tr>
    <tr>
      <th>Default</th>
      <td>XSendFileIgnoreLastModified off</td>
    </tr>
    <tr>
      <th>Context</th>
      <td>server config, virtual host, directory, .htaccess</td>
    </tr>
  </tbody>
</table>

<p>Setting <code>XSendFileIgnoreLastModified on</code> will ignore all Last-Modified headers the original output handler may have set.<br/>
This is helpful for applications that will generate such headers even for empty content.</p>

<h3>XSendFilePath</h3>

<table class="code directive" border="0" cellpadding="2" cellspacing="0">
  <tbody>
    <tr>
      <th>Description</th>
	  <td>White-list more paths</td>
    </tr>
    <tr>
      <th>Syntax</th>
      <td>XSendFilePath <code>absolute path</code></td>
    </tr>
    <tr>
      <th>Default</th>
      <td>None</td>
    </tr>
    <tr>
      <th>Context</th>
      <td>server config, virtual host, directory</td>
    </tr>
  </tbody>
</table>

<p>XSendFilePath allow you to add additional paths to some kind of white list. All files within these paths are allowed to get served through mod_xsendfile.</p>
<p>Provide an absolute path as Parameter to this directive.</p>
<p>You may provide more than one path.<p>
<h4>Remarks - Relative paths</h4>
<p>The current working directory (if it can be determined) will be always checked first.</p>
<p>If you provide relative paths via the X-SendFile header, then all whitelist items will be checked until a seamingly valid combination is found, i.e. the result is within the bounds of the whitelist item; it isn't checked at this point if the path in question actually exists.<br/>
Considering you whitelisted <code>/tmp/pool</code> and <code>/tmp/pool2</code> and your script working directory is <code>/var/www</code>.</p>
<p><code>X-SendFile: file</code></p>
<ol>
  <li><code>/var/www/file</code> - Within bounds of <code>/var/www</code>, OK</li>
</ol>
<p><code>X-SendFile: ../pool2/file</code></p>
<ol>
  <li><code>/var/www/../pool2/file = /var/pool2/file</code> - Not within bounds of <code>/var/www</code></li>
  <li><code>/tmp/pool/../pool2/file = /tmp/pool2/file</code> - Not within bounds of <code>/tmp/pool</code></li>
  <li><code>/tmp/pool2/../pool2/file = /tmp/pool2/file</code> - Within bounds of <code>/tmp/pool2</code>, OK</li>  
</ol>
<p>You still can only access paths that are whitelisted. However you have might expect a different behavior here, hence the documentation.</p>
<h4>Remarks - Inheritance</h4>
<p>The white list "inherits" entries from higher level configuration.<br/>
<pre>XSendFilePath /tmp
&lt;VirtualHost *&gt;
	ServerName someserver
	XSendFilePath /home/userxyz
&lt;/VirtualHost&gt;
&lt;VirtualHost *&gt;
	ServerName anotherserver
	XSendFilePath /var/www/somesite/
	&lt;Directory /var/www/somesite/fastcgis&gt;
		XSendFilePath /var/www/shared
	&lt;/Directory&gt;
&lt;/VirtualHost&gt;
</pre>
<p>Above example will give:</code>
<ul>
	<li>*<ul>
		<li><code>/tmp</code></li>
	</ul></li>
	<li>someserver<ul>
		<li><code>/tmp</code></li>
		<li><code>/home/userxyz</code></li>
	</ul></li>
	<li>another<ul>
		<li><code>/tmp</code></li>
		<li><code>/var/www/somesite</code></li>
		<li><code>/var/www/shared</code> (for scripts* located in /var/www/somesite/fastcgis)</li>
	</ul></li>
</ul>
<p style="font-size:small;">*) Scripts, in this context, mean the actual script-starters. E.g. PHP as a handler will use the .php itself, while in CGI mode refers to the starter.</p>
<p><em>Windows</em> users should take care to include the drive letter to those paths as well. Tests show that it has to be in upper-case.</p>


<h3>Example</h3>

<p><code>.htaccess</code></p>

<p class="code"><code>&lt;Files out.php&gt;<br />

XSendFile on
<br />

&lt;/Files&gt;</code></p>

<p><code>out.php</code></p>

<p class="code"><code><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);">&lt;?php<br />

</span><span style="color: rgb(0, 119, 0);">...<br />

if&nbsp;(</span><span style="color: rgb(0, 0, 187);">$user</span><span style="color: rgb(0, 119, 0);">-&gt;</span><span style="color: rgb(0, 0, 187);">isLoggedIn</span><span style="color: rgb(0, 119, 0);">())<br />

{<br />

&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 187);">header</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">"X-Sendfile:&nbsp;$path_to_somefile"</span><span style="color: rgb(0, 119, 0);">);<br />

&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 187);">header</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">"Content-Type:&nbsp;application/octet-stream"</span><span style="color: rgb(0, 119, 0);">);<br />

&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 187);">header</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">"Content-Disposition:&nbsp;attachment;&nbsp;filename=\"$somefile\""</span><span style="color: rgb(0, 119, 0);">);<br />

&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />

}<br />

</span><span style="color: rgb(0, 0, 187);">?&gt;<br />

</span>&lt;h1&gt;Permission&nbsp;denied&lt;/h1&gt;<br />

&lt;p&gt;Login&nbsp;first!&lt;/p&gt;</span></code></p>

<h2>Limitations / Issues / Security considerations</h2>

<ul>

  <li>The <code>Content-Encoding</code>
header - if present - will be dropped, as the module
cannot know if it was set by intention of the programmer or the
handler. E.g. php with output compression enabled will set this header,
but the replacement file send via mod_xsendfile is most likely not
compressed.</li>

  <li>The header key (X-SENDFILE) is not case-sensitive.</li>

  <li><strong>X-Sendfile will also send files that are
otherwise protected (e.g. Deny from all). This includes .htaccess and
such!</strong><br />
... as long as one has regular file access permissions defined in
the file system.<br />
But, on the other hand, how is this different from the usual scripting?</li>
</ul>

<h2>Credits</h2>

<p>The idea comes from <a href="http://www.lighttpd.net/">lighttpd</a>
- <span style="font-style: italic;">A fast web server
with minimal memory footprint</span>.</p>

<p>The module itself was inspired by many other Apache2 modules
such as mod_rewrite, mod_headers and obviously core.c.</p>

<h2>License</h2>

<p><strong>Copyright 2006-2010 by Nils Maier</strong></p>

<p>Licensed under the <em>Apache License, Version 2.0</em>
(the
"License"); you may not use this file except in compliance with the
License.</p>

<p>You may obtain a copy of the License at<br />

</p>

<p style="text-align: left; margin-left: 40px;"><a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></p>

<p>Unless
required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</p>

<p>
See the License for the specific language governing permissions and
limitations under the License.
</p>

<h2 id="changes">Changes</h2>
<h3>Version 0.12</h3>
<ul>
	<li>Now incorrect headers will be dropped early</li>
</ul>
<h3>Version 0.11.1</h3>
<ul>
	<li>Fixed some documentation bugs</li>
	<li>Built win32 binaries against latest httpd using MSVC9</li>
	<li>Updated MSVC Project files</li>
</ul>
<h3>Version 0.11</h3>
<ul>
	<li>Fixed large file support</li>
</ul>
<h3>Version 0.10</h3>
<ul>
	<li>Won't override Etag/Last-Modified if already set.</li>
	<li>New Configuration directive: XSendFileIgnoreEtag</li>
	<li>New Configuration directive: XSendFileIgnoreLastModified</li>
	<li>New Configuration directive: XSendFilePath</li>
	<li>Removed Configuration directive: XSendFileAllowAbove<br/>
	Use XSendFilePath instead.</li>
	<li>Improved header handling for FastCGI/CGI output (removing duplicate headers).</li>
</ul>
<h3>Version 0.9</h3>
<ul>
	<li>New configuration directive: XSendFileAllowAbove</li>
	<li>Initial FastCGI/CGI support</li>
	<li>Filter only added when needed</li>
</ul>
<h3>Version 0.8</h3>
<ul>
	<li>This is the initial public release.</li>
</ul>
	<div style="display:none;">
		<script type="text/javascript">

		  var _gaq = _gaq || [];
		  _gaq.push(['_setAccount', 'UA-2632517-2']);
		  _gaq.push(['_setDomainName', '.tn123.org']);
		  _gaq.push(['_trackPageview']);

		  (function() {
			var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
			ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
			var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
		  })();

		</script>
	</div>

</body>
</html>