|
1 | 1 |
|
2 |
| -# rfc6266 |
| 2 | +rfc6266 |
| 3 | +~~~~~~~ |
3 | 4 |
|
4 |
| -This module parses and generates HTTP Content-Disposition headers. |
| 5 | +This module parses and generates HTTP ``Content-Disposition`` headers. |
5 | 6 | These headers are used when getting resources for download;
|
6 | 7 | they provide a hint of whether the file should be downloaded,
|
7 | 8 | and of what filename to use when saving.
|
8 | 9 |
|
9 |
| -# Usage |
| 10 | +Usage |
| 11 | +~~~~~ |
10 | 12 |
|
11 |
| -## Receiver |
| 13 | +Receiver |
| 14 | +-------- |
12 | 15 |
|
13 |
| -`parse_headers` builds a `ContentDisposition` object from the |
14 |
| -`Content-Disposition` header and (as a fallback) the document |
| 16 | +``parse_headers`` builds a ``ContentDisposition`` object from the |
| 17 | +``Content-Disposition`` header and (as a fallback) the document |
15 | 18 | location. Shortcuts work with response objects from httplib2
|
16 | 19 | and the requests library.
|
17 | 20 |
|
18 |
| -Important attributes of `ContentDisposition` are `is_inline`, |
19 |
| -`filename_unsafe`, `filename_sanitized`. |
| 21 | +Important attributes of ``ContentDisposition`` are ``is_inline``, |
| 22 | +``filename_unsafe``, ``filename_sanitized``. |
20 | 23 |
|
21 |
| -## Sender |
| 24 | +Sender |
| 25 | +------ |
22 | 26 |
|
23 |
| -`build_header` builds a header value from a filename. |
| 27 | +``build_header`` builds a header value from a filename. |
24 | 28 |
|
25 |
| -# Security |
| 29 | +Security |
| 30 | +~~~~~~~~ |
26 | 31 |
|
27 |
| -The Content-Disposition filename should be used with caution. |
| 32 | +The ``Content-Disposition`` filename should be used with caution. |
28 | 33 | Do not let the sender overwrite an arbitrary filesystem location,
|
29 | 34 | pick arbitrary extensions or filenames with special meaning,
|
30 | 35 | pick filenames containing unusual or misleading characters, etc.
|
31 | 36 | Read RFC 6266 section 4.3 for more details.
|
32 | 37 |
|
33 |
| -# Compatibility |
34 | 38 |
|
35 |
| -Currently tested under Python 2.7, Python 2.6, Python 3.2, and PyPy (1.7). |
| 39 | +Testing |
| 40 | +~~~~~~~ |
36 | 41 |
|
37 |
| -# Testing |
38 |
| - |
39 |
| -To test in the current Python implementation: |
| 42 | +To test in the current Python implementation:: |
40 | 43 |
|
41 | 44 | py.test
|
42 | 45 |
|
43 |
| -To test compatibility across Python releases: |
| 46 | +To test compatibility across Python releases:: |
44 | 47 |
|
45 | 48 | tox
|
46 | 49 |
|
47 |
| -# References |
| 50 | +rfc6266 is currently tested under Python 2.7, Python 2.6, |
| 51 | +Python 3.2, and PyPy (1.7). |
| 52 | + |
| 53 | +References |
| 54 | +~~~~~~~~~~ |
48 | 55 |
|
49 | 56 | * RFC 6266 <https://tools.ietf.org/html/rfc6266>
|
50 |
| -specifies the Content-Disposition header |
| 57 | + specifies the Content-Disposition header |
51 | 58 | * RFC 5987 <https://tools.ietf.org/html/rfc5987>
|
52 |
| -specifies a way to encode non-ascii filenames |
| 59 | + specifies a way to encode non-ascii filenames |
53 | 60 | * TC 2231 <http://greenbytes.de/tech/tc2231/>
|
54 |
| -is a test suite for Content-Disposition headers |
| 61 | + is a test suite for Content-Disposition headers |
55 | 62 |
|
56 | 63 |
|
0 commit comments