[Twisted-Python] Patch for twisted.protocols.nntp

Matthias Urlichs smurf at smurf.noris.de
Sun Jun 22 11:14:24 EDT 2003

Since "suck" doesn't work for me for a variety of reasons, I decided to 
replace it with a solution based on twisted.protocol.nntp. After a few hours 
of hacking, I now have a nice program which nicely saturates my downlink 
bandwidth. ;-)

To make a long story short, the attached patch implements the changes and 
fixes I needed to actually get there.

The "Allow the article text to be a callable or deferred" change implements 
the common situation where I ask server B whether it would like to be fed 
article X before actually pulling that article from server A, and/or where 
the pull is still in progress.

There is one somewhat- incompatible change here, in that I return the GROUP 
results (article count, high and low numbers) as integers, not as text. In 
practice they're going to be int()ized anyway, so this should not be a 

# twisted/protocols/nntp.py
#     Fixes for news gateways / 'suck'-style operation / INN as server:
#     - The client uses \n and does NOT esacpe start-of-line dots.
#       The server uses \r\n and escapes dots ONCE, not twice (ouch).
#     - POST temporarily blocks streaming. Make sure this is observed,
#       pass a Deferred out for clients to restart themselves with
#     - Add a command to allow MODE READER
#     - Allow bare reply numbers without text
#     - Allow the article text to be a callable or a deferred
#     - use CHECK/TAKETHIS if there's a message ID
#     - return group article numbers (GROUP reply) as numbers
#     - Clean up article linefeed handling
# twisted/test/test_nntp.py
#     Make sure that dot escapes are passed cleanly.
#     Make sure that no empty lines are added at the end.
#     Use the unittest object for checking.
#     Use client-side line endings for the client,
#       assume that the server side is transparent.
#     Make sure that the test doesn't just peter out halfway through.
#     Remove the commented-out iterate() calls.
#       loopback() already does the work for us.

Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf at smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
Standards are different for all things, so the standard set by man is by
no means the only 'certain' standard.  If you mistake what is relative for
something certain, you have strayed far from the ultimate truth.
		-- Chuang Tzu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nntp.patch
Type: text/x-diff
Size: 18384 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20030622/8449162b/attachment.patch 

More information about the Twisted-Python mailing list