jstedfast / gmime

A C/C++ MIME creation and parser library with support for S/MIME, PGP, and Unix mbox spools.
GNU Lesser General Public License v2.1
115 stars 36 forks source link

Handling for long Newsgroups: headers seems suboptimal #162

Closed vallor closed 4 months ago

vallor commented 5 months ago

Hello, I use the pan newsreader, which uses gmime. Turns out Newsgroups: headers need to be handled specially, which doesn't seem to be happening in gmime.

This only happens when handling long Newsgroups: header fields, it would seem to be something to do with the wrapping. They end up looking like this:

Newsgroups: =?us-ascii?Q?alt=2Epolitics=2Eradical-left=2Calt=2Eabortion=2Calt=2Esociety=2Eliberalism=2C?= =?us-ascii?Q?alt=2Eactivism=2Edeath-penalty=2Calt=2Eatheism?=

News servers choke on that.

It looks like there should be a special formatter for Newsgroups in gmime-headers.c, but my C is so rusty I'm not sure how to graft that in.

Assistance appreciated. :)

Thank you,

-Scott

jstedfast commented 5 months ago

What should the Newsgroups: header value look like?

vallor commented 5 months ago

What should the Newsgroups: header value look like?

Newsgroups: alt.politics.radical-left, alt.abortion,alt.society.liberalism,alt.activism.death-penalty,alt.atheism

There needs to be at least one character after the header field name, and wrapping is handled by a newline, followed by whitespace (space or tab) and more entries. It is a comma-separated list.

I can find the RFC for News articles, if that would help.

jstedfast commented 5 months ago

Ok, so it's more that the value is getting encoded that is breaking news clients?

vallor commented 5 months ago

Ok, so it's more that the value is getting encoded that is breaking news clients?

It seems to only happen when posting the articles with a Newsgroup: line that wraps. Servers don't understand the encoding. Yes, it is primarily the encoding that is the problem.

vallor commented 5 months ago

The error message from the server following a post looks like: 441 No valid newsgroups in " =?us-ascii?Q?rec=2Earts=2Etv=2Cuk=2Ecomp=2Esys=2Emac=2Calt=2Ephilosophy=2E..."