Change option -r to accept a list of headers: -r h1,h2,h3,...
Asterisk is allowed to remove all headers and accept a list of exceptions:
-r *,-h1,-h2,...
-p h1,h2,h3:*,-p1,-p2,-p3
-p *,-h1,-h2,-h3:*,-p1,-p2,-p3
+ Change option -r to accept a list of headers: -r h1,h2,h3,...
+
+ Change option -r to remove all headers and accept a list of exceptions:
+-r *,-h1,-h2,...
+
+
Add ChangeLog.
WHAT'S NEW in version 2.3.8 (2014-02-26)
-Change option -r to accept a list of headers: -r h1,h2,h3,...
-
-
-Change option -r to remove all headers and accept a list of exceptions:
--r *,-h1,-h2,...
-
-
Change option -R to accept lists of headers and parameters:
-R h1,h2,h3:p1,p2,p3
Allow * and exceptions:
<option>-p *[,-header1,-header2,-header3,...]:*[,-param1,-param2,-param3,...]</option>
</arg>
<arg choice="opt">
- <option>-r header</option>
+ <option>-r header1[,header2,header3...]</option>
+ </arg>
+ <arg choice="opt">
+ <option>-r *[,-header1,-header2,-header3...]</option>
</arg>
<arg choice="opt">
<option>-R header:param</option>
</varlistentry>
<varlistentry>
- <term>-r header</term>
+ <term>-r header1[,header2,header3...]</term>
+ <listitem>
+ <para>
+ Add the header(s) to a list of headers to remove completely;
+ initially the list is empty.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>-r *[,-header1,-header2,-header3...]</term>
<listitem>
<para>
- Add the header to a list of headers to remove completely; initially
- the list is empty.
+ Remove all headers except listed.
</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 header1[,h2,h3,...]:param1[,p2,p3,...]] [-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 header1[,h2,...]|*[,-h1,...]] [-R header:param] [--remove-params=header] [-beit mask] [-o output_file] [input_file [output_file]]
""" % me)
if errormsg:
sys.stderr.write(errormsg + '\n')
def decode_headers(msg):
"Decode message headers according to global options"
- for header in gopts.remove_headers:
- del msg[header]
+ for header_list in gopts.remove_headers:
+ header_list = header_list.split(',')
+ if header_list[0] == '*': # Remove all headers except listed
+ header_list = _get_exceptions(header_list)
+ for header in msg.keys():
+ if header.lower() not in header_list:
+ del msg[header]
+ else: # Remove listed headers
+ for header in header_list:
+ del msg[header]
for header in gopts.remove_all_params:
value = msg[header]
--- /dev/null
+From test Sat Feb 1 00:00:00 2014
+Return-Path: <>
+Delivered-To: scr-admin@socal-raves.org
+Date: Sun, 23 Sep 2001 20:14:35 -0700 (PDT)
+From: Internet Mail Delivery <postmaster@ucla.edu>
+Subject: Delivery Notification: Delivery has failed
+To: scr-admin@socal-raves.org
+Message-id: <0GK500B04D0B8X@cougar.noc.ucla.edu>
+MIME-version: 1.0
+Sender: scr-owner@socal-raves.org
+Errors-To: scr-owner@socal-raves.org
+X-BeenThere: scr@socal-raves.org
+X-Mailman-Version: 2.1a3
+Precedence: bulk
+Content-Type: multipart/report; boundary="Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)"
+
+
+--Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py
+
+This report relates to a message you sent with the following header fields:
+
+ Message-id: <002001c144a6$8752e060$56104586@oxy.edu>
+ Date: Sun, 23 Sep 2001 20:10:55 -0700
+ From: "Ian T. Henry" <henryi@oxy.edu>
+ To: SoCal Raves <scr@socal-raves.org>
+ Subject: [scr] yeah for Ians!!
+
+Your message cannot be delivered to the following recipients:
+
+ Recipient address: jangel1@cougar.noc.ucla.edu
+ Reason: recipient reached disk quota
+
+
+--Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)
+Content-type: message/DELIVERY-STATUS
+
+Original-envelope-id: 0GK500B4HD0888@cougar.noc.ucla.edu
+Reporting-MTA: dns; cougar.noc.ucla.edu
+
+Action: failed
+Status: 5.0.0 (recipient reached disk quota)
+Original-recipient: rfc822;jangel1@cougar.noc.ucla.edu
+Final-recipient: rfc822;jangel1@cougar.noc.ucla.edu
+
+
+--Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)
+Content-type: MESSAGE/RFC822
+
+Return-path: scr-admin@socal-raves.org
+Date: Sun, 23 Sep 2001 20:10:55 -0700
+From: "Ian T. Henry" <henryi@oxy.edu>
+Subject: [scr] yeah for Ians!!
+Sender: scr-admin@socal-raves.org
+To: SoCal Raves <scr@socal-raves.org>
+Errors-to: scr-admin@socal-raves.org
+Message-id: <002001c144a6$8752e060$56104586@oxy.edu>
+X-Mailer: Microsoft Outlook Express 5.50.4522.1200
+Precedence: bulk
+Delivered-to: scr-post@babylon.socal-raves.org
+Delivered-to: scr@socal-raves.org
+X-Converted-To-Plain-Text: from multipart/alternative by demime 0.98e
+X-Converted-To-Plain-Text: Alternative section used was text/plain
+X-BeenThere: scr@socal-raves.org
+X-Mailman-Version: 2.1a3
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode.py
+
+I always love to find more Ian's that are over 3 years old!!
+
+Ian
+_______________________________________________
+For event info, list questions, or to unsubscribe, see http://www.socal-raves.org/
+
+
+
+--Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)--
+
--- /dev/null
+From test Sat Feb 1 00:00:00 2014
+MIME-version: 1.0
+Content-Type: multipart/report; boundary="Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)"
+
+
+--Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py
+
+This report relates to a message you sent with the following header fields:
+
+ Message-id: <002001c144a6$8752e060$56104586@oxy.edu>
+ Date: Sun, 23 Sep 2001 20:10:55 -0700
+ From: "Ian T. Henry" <henryi@oxy.edu>
+ To: SoCal Raves <scr@socal-raves.org>
+ Subject: [scr] yeah for Ians!!
+
+Your message cannot be delivered to the following recipients:
+
+ Recipient address: jangel1@cougar.noc.ucla.edu
+ Reason: recipient reached disk quota
+
+
+--Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)
+Content-type: message/DELIVERY-STATUS
+
+
+
+
+--Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)
+Content-type: MESSAGE/RFC822
+
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode.py
+
+I always love to find more Ian's that are over 3 years old!!
+
+Ian
+_______________________________________________
+For event info, list questions, or to unsubscribe, see http://www.socal-raves.org/
+
+
+
+--Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)--
+
test_file msg_22.txt msg_22.txt -P -p \*:name,filename
test_file msg_22.txt msg_22.txt -P -p Content-Type,Content-Disposition:\*
test_file msg_22.txt msg_22.txt -P -p '*,-Content-Id:*,-x-mac-type'
+test_file msg_16.txt msg_16-1.txt -r Received,List-Help,List-Post,List-Subscribe,List-Id,List-Unsubscribe,List-Archive
+test_file msg_16.txt msg_16-2.txt -r \*,-mime-version,-content-type
if [ "$RC" -eq 0 ]; then
echo "All tests passed!"