Re: Headers folding
Harald Alvestrand <[email protected]> Tue, 21 Apr 2009 12:58:32 +0200
| Newsgroups | gmane.ietf.usenet.format |
|---|---|
| Message-ID | <[email protected]> |
Julien ÉLIE wrote: > > Hi, > > As you are speaking about headers and compliance of USEFOR with > RFC 3977 and RFC 5322, I wonder what happens to folding. > > In RFC 3977, we have: > > > 9.7. Articles > > header = header-name ":" [CRLF] SP header-content CRLF > header-content = *(S-CHAR / [CRLF] WS) > S-CHAR = %x21-FF > WS = 1*(SP / TAB) > SP = %x20 > TAB = %x09 > > A.1. Header Folding > > NNTP allows a header line to be folded (by inserting a CRLF pair) > before any space or TAB character. > > Both email and Netnews articles are required to have at least one > octet other than space or TAB on each header line. Thus, folding can > only happen at one point in each sequence of consecutive spaces or > TABs. Netnews articles are further required to have the header name, > colon, and following space all on the first line; folding may only > happen beyond that space. Finally, some non-conforming software will > remove trailing spaces and TABs from a line. Therefore, it might be > inadvisable to fold a header after a space or TAB. > > For maximum safety, header lines SHOULD conform to the following > syntax rather than to that in Section 9.7. > > > header = header-name ":" SP [header-content] CRLF > header-content = [WS] token *( [CRLF] WS token ) > > token = 1*P-CHAR > P-CHAR = A-CHAR / UTF8-non-ascii > A-CHAR = %x21-7E > UTF8-non-ascii = UTF8-2 / UTF8-3 / UTF8-4 > UTF8-2 = %xC2-DF UTF8-tail > UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2UTF8-tail / > %xED %x80-9F UTF8-tail / %xEE-EF 2UTF8-tail > UTF8-4 = %xF0 %x90-BF 2UTF8-tail / %xF1-F3 3UTF8-tail / > %xF4 %x80-8F 2UTF8-tail > UTF8-tail = %x80-BF > > > > > Well, my question is for 9.7: > > header = header-name ":" [CRLF] SP header-content CRLF > > Is it a valid header for USEFOR? and for RFC 5322? I'm sure it is possible to construct a header that conforms to this syntax but isn't valid in USEFOR (the header "Date: nonsense" is illegal both in USEFOR and in RFC 5322, but conforms to the syntax above). The syntax above also (and perhaps more importantly) allows UTF-8 in headers, something that is illegal in RFC 5322 and USEFOR. You should check for conformance with the EAI spec. > > > In A.1, it looks strange to have written the syntax this way: > > header-content = [WS] token *( [CRLF] WS token ) > > Hopefully it works! (token does not contain WS but it comes > afterwards with "WS token"!) >