<arg choice="opt">
<option>-p header:param</option>
</arg>
+ <arg choice="opt">
+ <option>-r header</option>
+ </arg>
<arg choice="opt">
<option>-beit mask</option>
</arg>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>-r header</term>
+ <listitem>
+ <para>
+ Add the header to a list of headers to remove completely; initially
+ the list is empty.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>-b mask</term>
<listitem>
for header, param in gopts.decode_header_params:
decode_header_param(msg, header, param)
+ for header in gopts.remove_headers:
+ del msg[header]
+
def set_header(msg, header, value):
"Replace header"
("Content-Disposition", "filename"),
]
+ # A list of headers to remove
+ remove_headers = []
+
totext_mask = [] # A list of content-types to decode
binary_mask = [] # A list to pass through
ignore_mask = [] # Ignore (skip, do not decode and do not include into output)
from getopt import getopt, GetoptError
try:
- options, arguments = getopt(sys.argv[1:], 'hVcCDPH:f:d:p:b:e:i:t:o:',
+ options, arguments = getopt(sys.argv[1:], 'hVcCDPH:f:d:p:r:b:e:i:t:o:',
['help', 'version', 'host'])
except GetoptError:
usage(1)
gopts.decode_header_params.append(value.split(':', 1))
elif option == '-P':
gopts.decode_header_params = []
+ elif option == '-r':
+ gopts.remove_headers.append(value)
elif option == '-t':
gopts.totext_mask.append(value)
elif option == '-b':