[Spambayes] Client/server model

Greg Ward gward@python.net
Thu Oct 17 21:52:08 2002


On 17 October 2002, Guido van Rossum said:
> Neale's hammie client and server seem to me to be wasting some
> effort.  Currently, what happens, is:
> 
>   cli sends the entire message to svr
> 
>   svr parses and scores the message
>   svr inserts the X-Hammie-Disposition header in the message
>   svr sends the message, thus modified, back
> 
>   cli prints the returned, modified, message to stdout

Arrggh.  That's exactly how SpamAssassin's spamc/spamd work, and it's
a pain-in-the-ass for anyone who wants to access spamd in an unusual
way.

> What would make more sense from the POV of minimizing traffic and
> minimizing work done in the server:
> 
>   cli parses the message
>   cli sends the list of tokens to svr
> 
>   svr scores the list of tokens
>   svr returns the text to be inserted in the X-Hammie-Disposition header
> 
>   cli inserts the X-Hammie-Disposition in the message
>   cli prints the message to stdout

If there are multiple client implementations, then spreading work across
clients also means duplicating code.  Yuck.  Based on my experience with
SA, I think I'd prefer a model like this:

  cli sends message headers
  svr parses the headers
  cli sends message body OR individual attachments
      [ie. the protocol needs some state so the client can say,
       "I'm sending you the headers now", or "I'm sending you the
       entire body now", or "I'm sending one attachment now"]
  svr parses the message body/attachments/whatever
  cli tells the server what it wants: eg. "give me the
      X-Hammie-Disposition header", or "give me just the score", or
      "give me the top-N scoring words and their probabilities"
  svr gives the client what it wants

Yes, I know this is more complex.  But it's how I wish SA's spamd
protocol worked!

        Greg
-- 
Greg Ward <gward@python.net>                         http://www.gerg.ca/
I have the power to HALT PRODUCTION on all TEENAGE SEX COMEDIES!!