Change option -d to decode all headers and accept a list of exceptions:
-d *,-h1,-h2,...
+ Change option -p to accept lists of headers and parameters:
+-p h1,h2,h3,..:p1,p2,p3,..
+
Add ChangeLog.
WHAT'S NEW in version 2.3.8 (2014-02-26)
-Change option -p to accept lists of headers and parameters:
--p h1,h2,h3:p1,p2,p3
-Allow * and exceptions:
+Allow * and exceptions for -p:
-p h1,h2,h3:*,-p1,-p2,-p3
-p *,-h1,-h2,-h3:p1,p2,p3
-p *,-h1,-h2,-h3:*,-p1,-p2,-p3
<option>-d *[,-header1,-header2,-header3...]</option>
</arg>
<arg choice="opt">
- <option>-p header:param</option>
+ <option>-p header1[,header2,header3,...]:param1[,param2,param3,...]</option>
</arg>
<arg choice="opt">
<option>-r header</option>
</para>
</refsect1>
+<refsect1>
+ <para>
+ Please be warned that in the following options asterisk is a shell
+ metacharacter and should be escaped or quoted. Either write -d \*,-h1,-h2
+ or -d '*,-h1,-h2' or such.
+ </para>
+</refsect1>
<refsect1>
<title>OPTIONS</title>
this mode it would be meaningless to give more than one -d options
but the program doesn't enforce it.
</para>
-
- <para>
- Please be warned that the asterisk is a shell metacharacter and
- should be escaped or quoted. Either write -d \*,-h1,-h2 or -d
- '*,-h1,-h2'.
- </para>
</listitem>
</varlistentry>
</varlistentry>
<varlistentry>
- <term>-p header:param</term>
+ <term>-p header1[,header2,header3,...]:param1[,param2,param3,...]</term>
<listitem>
<para>
- Add the pair (header, param) to a list of headers parameters to
- decode; initially the list contains header "Content-Type",
- parameter "name" and header "Content-Disposition", parameter
- "filename".
+ Add the parameters(s) to a list of headers parameters to decode;
+ the parameters will be decoded only for the given header(s).
+ Initially the list contains header "Content-Type", parameter "name";
+ and header "Content-Disposition", parameter "filename".
</para>
</listitem>
</varlistentry>
def usage(code=0, errormsg=''):
version(0)
sys.stdout.write("""\
-Usage: %s [-h|--help] [-V|--version] [-cCDP] [-H|--host=hostname] [-f charset] [-d header1[,h2,...]|*[,-h1,...]] [-p header:param] [-r header] [-R header:param] [--remove-params=header] [-beit mask] [-o output_file] [input_file [output_file]]
+Usage: %s [-h|--help] [-V|--version] [-cCDP] [-H|--host=hostname] [-f charset] [-d header1[,h2,...]|*[,-h1,...]] [-p header1[,h2,h3,...]:param1[,p2,p3,...]] [-r header] [-R header:param] [--remove-params=header] [-beit mask] [-o output_file] [input_file [output_file]]
""" % me)
if errormsg:
sys.stderr.write(errormsg + '\n')
for header in header_list:
decode_header(msg, header)
- for header, param in gopts.decode_header_params:
- decode_header_param(msg, header, param)
+ for header_list, param_list in gopts.decode_header_params:
+ header_list = header_list.split(',')
+ param_list = param_list.split(',')
+ for header in header_list:
+ for param in param_list:
+ decode_header_param(msg, header, param)
def set_header(msg, header, value):
test_file msg_22.txt msg_22-1.txt -r content-id
test_file msg_29.txt msg_29-1.txt -R Content-Type:title
test_file msg_18.txt msg_18-1.txt --remove-params=X-Foobar-Spoink-Defrobnit
+test_file msg_22.txt msg_22.txt -P -p Content-Type,Content-Disposition:name,filename
if [ "$RC" -eq 0 ]; then
echo "All tests passed!"