james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard O. Hammer" <ROHam...@EarthLink.net>
Subject new InputStream class for mail data
Date Wed, 02 Jul 2003 16:05:24 GMT
Attached you will find a class that I offer for your consideration. It 
is called SMTPDataInputStream and it would be used in the doDATA() 
method of SMTPHandler.  There it would replace 
CharTerminatedInputStream, BytesReadResetInputStream, 
SizeLimitedInputStream, and DotStuffingInputStream, since I believe it 
does the work of all those.

There are minor ways in which this class responds differently, and
more correctly I believe, than the current CharTerminatedInputStream. 
  The end of mail data indicator which this recognizes is a period
alone in a line, rather than CRLF.CRLF as recognized in James at
present.  As such this class returns the CRLF which terminates the
last line of message body data (the CRLF before the period), and it
allows the possibility of empty mail data (with a period being the
first character sent in the data).

I raised the question of whether these changes are indeed a better
interpretation of RFC 2821 on the mailing list ietf-smtp@imc.org.  If
you like you can see that thread starting at
http://www.imc.org/ietf-smtp/mail-archive/msg00703.html .  If you read
that thread and think the question remains unresolved you might adopt
the bias which I use in this case: multiply the value of each word
from Dan Bernsetin by 1000.

Improved performance would be another advantage which I would expect
from adopting this class in James.  The present stack of InputStreams
makes more method calls for each byte read than this replacement. But, 
I have to admit, it could be that performance in this code is not a 
major concern.

It is possible that this class could also serve in NNTPHandler to
replace CharTerminatedInputStream there, but I am not familiar with
the code in NNTPHandler.

I also attach a file showing old and new blocks of code in 
SMTPHandler, showing changes needed to employ this new 
SMTPDataInputStream.  In addition to these changes, the package name 
for SMTPDataInputStream will need to be corrected, as well as the 
importing of WatchDog and MessageSizeException.

I have tested this SMTPDataInputStream as a unit, and it performs 
correctly in every test I have thought to give it.  But I have not 
tested it installed in SMTPHandler.

Rich Hammer
Hillsborough, N.C.



Mime
View raw message