Bug 1520 - spamd response headers
Summary: spamd response headers
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamc/spamd (show other bugs)
Version: 2.50
Hardware: All All
: P3 normal
Target Milestone: 2.60
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-22 04:29 UTC by Alan Ford
Modified: 2003-08-20 09:52 UTC (History)
0 users



Attachment Type Modified Status Actions Submitter/CLA Status
fix as described patch None Justin Mason [HasCLA]
additional cleanup of doco patch None Justin Mason [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Ford 2003-02-22 04:29:06 UTC
Two small issues with the new spamd:
* If $method eq "SYMBOLS", the line should end with a \r\n

-          $msg_resp = $status->get_names_of_tests_hit;
+          $msg_resp = $status->get_names_of_tests_hit . "\r\n";

If the spamc version is under 1.3, it shouldn't print the Content-Length:
header, it should print the $spamhdr header:

        else {
-           printf $client "Content-length: %d\r\n\r\n%s",
-                       length($msg_resp), $msg_resp;
+           print $client "$spamhdr\r\n\r\n$msg_resp";
Comment 1 Justin Mason 2003-03-18 16:17:13 UTC
Thanks Alan -- I've fixed the 2nd one, but the 1st one (appending the newline)
I'm going to leave as-is.  Basically, if I change that, I'll be changing the
protocol -- which really should require a bump in the version.  I don't want
to do that if I can avoid it, again.  And I don't
think anyone really finds it particularly hard to parse without a trailing
newline anyway, it just looks a little ugly.
Comment 2 Alan Ford 2003-03-18 17:29:04 UTC
It's not a change of protocol -- spamd always used to end the SYMBOLS with a
newline (all other output does end with a newline still, I think), I assumed
that the lack of a newline in this new spamd was simply an erroneous oversight.

It's probably OK in my program (I haven't checked without the newline yet),
however it would be good to be consistant!
Comment 3 Antony Mawer 2003-03-18 18:06:26 UTC
Subject: Re: [SAdev]  spamd response headers 


> It's not a change of protocol -- spamd always used to end the SYMBOLS with a
> newline (all other output does end with a newline still, I think), I assumed
> that the lack of a newline in this new spamd was simply an erroneous oversigh
> t.

did it?  bugger. ;)   Must verify that when I get a chance, may have to
refix that...

--j.

Comment 4 Alan Ford 2003-08-18 06:13:28 UTC
It seems this has still not been corrected in the latest versions, could you
please apply the fix to the CVS version? spamd always used to end that line with
a "\r\n", and this omission has caused a few incompatibilities when I brought
some new spamd servers online recently. Thanks.
Comment 5 Justin Mason 2003-08-18 13:03:30 UTC
IIRC -- I can't find the bug now -- we decided to keep compat with 2.5x
and *not* add an extra newline, since there was no point flip-flopping
between 2.4x and 2.5x behaviour.
(and it's trivial to decode either way once you know about it).
the doco was updated to note:

> SYMBOLS command returns the same as CHECK, followed by a line listing all the
> rule names, separated by commas.  Note that some versions of the protocol
> terminate this line with "\r\n", and some do not, due to an oversight; so
> clients should be flexible on this point.
Comment 6 Theo Van Dinter 2003-08-18 18:18:19 UTC
since the change was made consciously, I'm reclosing the ticket.
Comment 7 Alan Ford 2003-08-19 01:43:13 UTC
Sorry, I missed that change in the documentation. Anyway, I could sit here and
churn out a long list of why it should be reverted to the original behaviour,
but I won't :)  Instead, this seems to be a good compromise:

        elsif($method eq "SYMBOLS") {
           $msg_resp = $status->get_names_of_tests_hit;
+                 $msg_resp .= "\r\n" if ($version < 1.3);
         }

Would you be willing to consider that? The omission of "\r\n" coincided with the
change in spamd protocol from 1.2 to 1.3, so this would ensure maximum
compatibility.
Comment 8 Justin Mason 2003-08-20 10:57:36 UTC
looking at the Changes log, you're dead right -- the change was made just before
the protocol version number got bumped, and both changes occured within one
release.  So that's a good idea.
Comment 9 Justin Mason 2003-08-20 10:58:56 UTC
Created attachment 1246 [details]
fix as described

Here it is as a patch.
Comment 10 Justin Mason 2003-08-20 11:11:46 UTC
Created attachment 1247 [details]
additional cleanup of doco

Add more details on where clients should be flexible in parsing
the results from these verbs.
Comment 11 Justin Mason 2003-08-20 11:12:25 UTC
bumping pri
Comment 12 Theo Van Dinter 2003-08-20 12:09:49 UTC
+1
Comment 13 Daniel Quinlan 2003-08-20 17:49:01 UTC
+1 okay
Comment 14 Justin Mason 2003-08-20 17:52:52 UTC
applied