I'm developing some python scripts to implement an NNTP/WordPress
gateway, and I ran into unexpected behavior (and a less than helpful
error message) from inews. INN is from the inn2-2.6.0-2 package through
apt on linux mint.
Python's email.message module creates messages that (by default? I
wasn't able to find a setting for this) terminate lines with \r\n
(CRLF). Feeding those messages to 'inews -h -O' produces the error
message (from memory) "No space after colon in <the first line of the
article body>".
inews is not nntp just as sendmail is not smtp. Both run inside your Unix system and use the Unix \n line terminator. If you were opening a TCP connection to port 119 and issuing nntp commands, then you would use \r\n
as RFC 3877 says.
In python3, email.message normally uses \n line terminators unless you
tell it to use the email.policy.SMTP or email.policy.SMTPUTF8 policy
option. So don't do that. If you're still using python2, this would
be a good time to upgrade.
It may make sense to check if the first line of the input ends in \r\n
and, if so, call wire_to_native on the input buffer before processing
it. inews isn't really designed to accept arbitrary line endings, but
it looks easy enough to make it compatible with CRLF line endings.
But, still, what's the benefit to treating \r as folding whitespace in
this case?
It may make sense to check if the first line of the input ends in \r\n
and, if so, call wire_to_native on the input buffer before processing it. >inews isn't really designed to accept arbitrary line endings, but it looks >easy enough to make it compatible with CRLF line endings.
Russ Allbery <eagle@eyrie.org> wrote:
It may make sense to check if the first line of the input ends in \r\n
and, if so, call wire_to_native on the input buffer before processing
it. inews isn't really designed to accept arbitrary line endings, but
it looks easy enough to make it compatible with CRLF line endings.
On the other hand, INN is 30 years old and I don't recall this
particular question coming up before, so perhaps it doesn't need
solving.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 87:55:52 |
Calls: | 6,658 |
Files: | 12,203 |
Messages: | 5,333,954 |