Thread View: news.software.nntp
13 messages
13 total messages
Started by Gregg Woodcock
Tue, 09 Mar 2004 18:47
MIME peculiarities (C-T and C-T-E); help please!
Author: Gregg Woodcock
Date: Tue, 09 Mar 2004 18:47
Date: Tue, 09 Mar 2004 18:47
24 lines
2129 bytes
2129 bytes
#1: Is it valid for a multipart MIME message to have the "Content-Transfer-Encoding" header in the main (envelope) header? RFC 1521 clearly implies (but does not directly state) it is not valid but yet I see it happening anyway. If it is invalid, should it just be ignored? If it is valid, to what does it apply? If it is valid my guess would be that it applies to any sub-part to which it can apply but which does not already have it's own Content-Transfer-Encoding header. What if both parts have this header (I assume the sub-part's header "wins")? #2: I thought one of the foundational NNTP/SMTP requirements was that every line in the head of a message contains a COMPLETE header (i.e. multiple headers on 1 line is not allowed; nor is a header allowed to span more than 1 line). How is it that the MIME Content-Type header sometimes violates this as per this example: http://groups.google.com/groups?selm=404593c5%40e-post.inode.at&output=gplain I am thinking of adding code to handle this case that looks for a continuation of value clauses on the next line if the current line ends in a ';' but for which headers should this be done (obviously not for headers such as "From:" and "Subject:")?
Re: MIME peculiarities (C-T and C-T-E); help please!
Author: Russ Allbery
Date: Tue, 09 Mar 2004 19:13
Date: Tue, 09 Mar 2004 19:13
65 lines
4397 bytes
4397 bytes
In news.software.nntp, Gregg Woodcock <woodcock@SonLightSoftware.com> writes:
> #1: Is it valid for a multipart MIME message to have the
> "Content-Transfer-Encoding" header in the main (envelope) header? RFC
> 1521 clearly implies (but does not directly state) it is not valid but
> yet I see it happening anyway. If it is invalid, should it just be
> ignored?
RFC 1521 is obsolete; the current standard is RFC 2045. It says:
6.4. Interpretation and Use
If a Content-Transfer-Encoding header field appears as part of a
message header, it applies to the entire body of that message. If a
Content-Transfer-Encoding header field appears as part of an entity's
headers, it applies only to the body of that entity. If an entity is
of type "multipart" the Content-Transfer-Encoding is not permitted to
have any value other than "7bit", "8bit" or "binary". Even more
severe restrictions apply to some subtypes of the "message" type.
which seems to imply that CTE is valid at the top level and applies to the
whole message. Note, however, that this text bans any CTE at the top
level that requires you to *do* anything (no quoted-printable or base64),
which means that in practice I believe all it does is set the default CTE
for all the parts of the multipart.
> If it is valid, to what does it apply? If it is valid my guess would be
> that it applies to any sub-part to which it can apply but which does not
> already have it's own Content-Transfer-Encoding header. What if both
> parts have this header (I assume the sub-part's header "wins")?
The CTE in the sub-part would override the CTE at the top level. Note,
however, that if the top level CTE claims that the message is 7bit,
obviously no sub-part could have a CTE of 8bit, since that would make the
top-level CTE a lie. A sub-part *could* have a CTE of base64 or
quoted-printable, though.
> #2: I thought one of the foundational NNTP/SMTP requirements was that
> every line in the head of a message contains a COMPLETE header (i.e.
> multiple headers on 1 line is not allowed; nor is a header allowed to
> span more than 1 line). How is it that the MIME Content-Type header
> sometimes violates this as per this example:
> http://groups.google.com/groups?selm=404593c5%40e-post.inode.at&output=gplain
NNTP/SMTP don't say anything about the structure of headers. You want to
see RFC 2822 instead. What you're seeing there is a continuation line,
which is valid. Any line following a header that begins with whitespace
is taken to be a continuation of that header, and there are explicit rules
in RFC 2822 for how to semantically interpret such headers.
> I am thinking of adding code to handle this case that looks for a
> continuation of value clauses on the next line if the current line ends
> in a ';' but for which headers should this be done (obviously not for
> headers such as "From:" and "Subject:")?
Any header can be continued. That's not the right thing to look for; you
instead want to look for a line beginning with whitespace. See RFC 2822
for the details.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: MIME peculiarities (C-T and C-T-E); help please!
Author: Jesper Harder
Date: Tue, 09 Mar 2004 19:15
Date: Tue, 09 Mar 2004 19:15
19 lines
2108 bytes
2108 bytes
woodcock@SonLightSoftware.com (Gregg Woodcock) writes: > #1: Is it valid for a multipart MIME message to have the > "Content-Transfer-Encoding" header in the main (envelope) header? RFC > 1521 clearly implies (but does not directly state) it is not valid but > yet I see it happening anyway. RFC 1521 is obsolete. See RFC 2045 section 6.4 instead. And yes, a CTE header is allowed for a composite MIME type, although only the values '7bit', '8bit' or 'binary' are permitted. > #2: I thought one of the foundational NNTP/SMTP requirements was that > every line in the head of a message contains a COMPLETE header (i.e. > multiple headers on 1 line is not allowed; nor is a header allowed to > span more than 1 line). This is nonsense. A header is allowed to span multiple lines, see RFC 2822, section 2.2.3.
Re: MIME peculiarities (C-T and C-T-E); help please!
Author: Kjetil Torgrim Homme
Date: Tue, 09 Mar 2004 20:30
Date: Tue, 09 Mar 2004 20:30
21 lines
2035 bytes
2035 bytes
[Russ Allbery]: > > The CTE in the sub-part would override the CTE at the top level. > Note, however, that if the top level CTE claims that the message > is 7bit, obviously no sub-part could have a CTE of 8bit, since > that would make the top-level CTE a lie. it is only a lie if there are characters with the 8th bit set. | It should also be noted that, by definition, if a composite entity | has a transfer-encoding value such as "7bit", but one of the | enclosed entities has a less restrictive value such as "8bit", | then either the outer "7bit" labelling is in error, because 8bit | data are included, or the inner "8bit" labelling placed an | unnecessarily high demand on the transport system because the | actual included data were actually 7bit-safe. it's not illegal, but you shouldn't do it, either. -- Kjetil T.
Re: MIME peculiarities (C-T and C-T-E); help please!
Author: Bill Davidsen
Date: Thu, 25 Mar 2004 17:20
Date: Thu, 25 Mar 2004 17:20
28 lines
2499 bytes
2499 bytes
Gregg Woodcock wrote:
>
> #2: I thought one of the foundational NNTP/SMTP requirements was that
> every line in the head of a message contains a COMPLETE header (i.e.
> multiple headers on 1 line is not allowed; nor is a header allowed to
> span more than 1 line). How is it that the MIME Content-Type header
> sometimes violates this as per this example:
> http://groups.google.com/groups?selm=404593c5%40e-post.inode.at&output=gplain
>
> I am thinking of adding code to handle this case that looks for a
> continuation of value clauses on the next line if the current line
> ends in a ';' but for which headers should this be done (obviously not
> for headers such as "From:" and "Subject:")?
A header line may be continued if the next line is (a) non-blank and (b)
starts with whitespace. My hacked perl code drops trailing whitespace
from the first line, the head of the 2nd line, and concatentates with a
single blank between the lines.
I don't believe this is 100% RFC compliant, but it is really easy to
code and works in real life.
--
-bill davidsen (davidsen@tmr.com)
"The secret to procrastination is to put things off until the
last possible moment - but no longer" -me
Re: MIME peculiarities (C-T and C-T-E); help please!
Author: Russ Allbery
Date: Thu, 25 Mar 2004 19:49
Date: Thu, 25 Mar 2004 19:49
21 lines
2000 bytes
2000 bytes
In news.software.nntp, Bill Davidsen <davidsen@tmr.com> writes:
> A header line may be continued if the next line is (a) non-blank and (b)
> starts with whitespace. My hacked perl code drops trailing whitespace
> from the first line, the head of the 2nd line, and concatentates with a
> single blank between the lines.
> I don't believe this is 100% RFC compliant, but it is really easy to code
> and works in real life.
The RFC-standard unfolding is actually pretty straightforward to
implement. It says that the newline is not a part of the header content
but all of the whitespace is (since the folding newline can only be added
before whitespace).
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: MIME peculiarities (C-T and C-T-E); help please!
Author: Malcolm Dew-Jones
Date: Thu, 25 Mar 2004 20:43
Date: Thu, 25 Mar 2004 20:43
21 lines
2095 bytes
2095 bytes
Russ Allbery (rra@stanford.edu) wrote: : In news.software.nntp, Bill Davidsen <davidsen@tmr.com> writes: : > A header line may be continued if the next line is (a) non-blank and (b) : > starts with whitespace. My hacked perl code drops trailing whitespace : > from the first line, the head of the 2nd line, and concatentates with a : > single blank between the lines. : > I don't believe this is 100% RFC compliant, but it is really easy to code : > and works in real life. : The RFC-standard unfolding is actually pretty straightforward to : implement. It says that the newline is not a part of the header content : but all of the whitespace is (since the folding newline can only be added : before whitespace). In other words, the header line _must_ have white space in it if you wish to be able to fold it. Otherwise there's no way to put it on a continuation line (since that always forces the extracted header to have some white space).
Re: MIME peculiarities (C-T and C-T-E); help please!
Author: Jesper Harder
Date: Thu, 25 Mar 2004 22:22
Date: Thu, 25 Mar 2004 22:22
18 lines
1858 bytes
1858 bytes
yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) writes: > In other words, the header line _must_ have white space in it if you wish > to be able to fold it. Otherwise there's no way to put it on a > continuation line (since that always forces the extracted header to have > some white space). You can use an RFC 2047 encoding to fold at a non-whitespace character, because whitespace between encoded-words must be removed. For example Subject: =?us-ascii?q?foo?= =?us-ascii?q?bar?= decodes to: Subject: foobar
Re: MIME peculiarities (C-T and C-T-E); help please!
Author: Gregg Woodcock
Date: Mon, 05 Apr 2004 04:14
Date: Mon, 05 Apr 2004 04:14
12 lines
1516 bytes
1516 bytes
Jesper Harder <harder@myrealbox.com> wrote in message news:<m3brmkk1n1.fsf@defun.localdomain>... > You can use an RFC 2047 encoding to fold at a non-whitespace > character, because whitespace between encoded-words must be removed. > For example > > Subject: =?us-ascii?q?foo?= > =?us-ascii?q?bar?= > decodes to: > Subject: foobar What RFC defines the "?us-ascii?q?" part (et. al.)?
Re: MIME peculiarities (C-T and C-T-E); help please!
Author: Russ Allbery
Date: Mon, 05 Apr 2004 04:22
Date: Mon, 05 Apr 2004 04:22
22 lines
1934 bytes
1934 bytes
In news.software.nntp, Gregg Woodcock <woodcock@SonLightSoftware.com> writes:
> Jesper Harder <harder@myrealbox.com> wrote:
>> You can use an RFC 2047 encoding to fold at a non-whitespace
>> character, because whitespace between encoded-words must be removed.
>> For example
>> Subject: =?us-ascii?q?foo?=
>> =?us-ascii?q?bar?=
>> decodes to:
>> Subject: foobar
> What RFC defines the "?us-ascii?q?" part (et. al.)?
As mentioned above, RFC 2047.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: MIME peculiarities (C-T and C-T-E); help please!
Author: Rob Yampolsky
Date: Mon, 28 Jun 2004 17:30
Date: Mon, 28 Jun 2004 17:30
41 lines
2945 bytes
2945 bytes
> > A header line may be continued if the next line is (a) non-blank and (b) > starts with whitespace. My hacked perl code drops trailing whitespace > from the first line, the head of the 2nd line, and concatentates with a > single blank between the lines. > > I don't believe this is 100% RFC compliant, but it is really easy to > code and works in real life. > > Hi. I've come late to this discussion, but I think it's related to a problem I'm seeing. I've set up a .forward file to have sendmail run incoming mail through a script that wants to extract and process an XML attachment. My script copies the incoming mail stream to a temp file before playing with it. Originally, this was a simple 'while read; do echo; done' loop. I'm using munpack to extract the attachment (suggestions for something better?), and it balks at Outlook-generated attachments. The Content-type: and a few other Content-... headers are coming across from outlook ending with semicolons and continued on the next line *without* any leading whitespace. Munpack says there's no attachment. I changed my .forward script to check for any lines beginning and ending with "Content-...; and to echo them replacing the trailing newline with a blank to effectively concatenate the next line. This seems to get munpack to work. Questions? 1. Is Outlook doing it wrong here? 2. Is munpack just outdated software (version 1.6) that should know how to handle this? 3. Is it possible that Outlook is including the required leading whitespace, and it's getting lost due to the .forward mechanism. Thanks, -Rob
Re: MIME peculiarities (C-T and C-T-E); help please!
Author: Russ Allbery
Date: Mon, 28 Jun 2004 19:54
Date: Mon, 28 Jun 2004 19:54
20 lines
2017 bytes
2017 bytes
In news.software.nntp, Rob Yampolsky <me@nospam.org> writes:
> I'm using munpack to extract the attachment (suggestions for something
> better?), and it balks at Outlook-generated attachments. The
> Content-type: and a few other Content-... headers are coming across from
> outlook ending with semicolons and continued on the next line *without*
> any leading whitespace. Munpack says there's no attachment.
This is completely broken, yes. There must always be leading whitespace
on continuation lines of headers.
I've never seen Outlook generate that sort of broken message. Are you
sure that something else isn't stripping the leading whitespace?
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: MIME peculiarities (C-T and C-T-E); help please!
Author: Rob Yampolsky
Date: Tue, 06 Jul 2004 15:11
Date: Tue, 06 Jul 2004 15:11
30 lines
2121 bytes
2121 bytes
Russ Allbery wrote: > > This is completely broken, yes. There must always be leading whitespace > on continuation lines of headers. > > I've never seen Outlook generate that sort of broken message. Are you > sure that something else isn't stripping the leading whitespace? > Come to think of it, I'll bet I'm screwing it up. My .forward script has code like this: while read line; do echo line >>$MAILTEMP done I'll bet the 'read' command strips off leading whitespace. Obviously, what I'm trying to do is drain the mail message from stdin into a temp file so I can work on it with munpack, etc. I assume most .forward scripts need to do something like this. I guess 'cat -' would have worked better... Thanks, Rob
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads