This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ajvant
Recipients ajvant, brian.curtin, chasonr, christian.heimes, giampaolo.rodola, janssen, jelie, pitrou
Date 2010-11-02.08:38:22
SpamBayes Score 1.6653345e-16
Marked as misclassified No
Message-id <1288687114.88.0.948001871059.issue1926@psf.upfronthosting.co.za>
In-reply-to
Content
At Antoine's suggestion I've written a new patch for this for 3.2, adding support for both SSL on 563 and STARTTLS on a normal connection. A NNTP_SSL class supports the former and a NNTP.starttls() method supports the latter. As a side effect of getting starttls working I had to add a NNTP.login() method as well. (see below)

The patch updates nntplib.py, test_nntplib.py, nntplib.rst, and Misc/NEWS. 

Some implementation notes: 

By default, NNTP objects attempt to log in during initialization,and there didn't seem to be any support for logging in later. This was a problem as STARTTLS has to be issued before logging in. In order to get around this and handle a STARTTLS nuance involving CAPABILITIES, I moved the authentication part of _NNTPBase.__init__ into a method of its own, NNTP.login(), and another piece of it into NNTP.getcapabilities(). This doesn't affect the observable behavior of NNTP() or the existing methods.

As a side note, IMHO NNTP shouldn't attempt to log in at initialization at all. The user, password, and usenetrc args should not be part of the constructors and the program using the library should be able to choose when or if to log in after connecting. I couldn't think of any way to do this without breaking existing programs, though. At the very least I think usenetrc should default to False, but that would break programs that rely on the default behavior too, I think. 

I updated the test cases, with a caveat. They use gmane to perform the tests. Gmane doesn't support starttls. Therefor the tests currently only check for correct failure rather than correct success. There's test code for the starttls() method but it never runs. I checked the functionality against eternal-september to be sure it does, in fact, correctly succeed as well, but I'm not about to put my login details in the automatic test script. ;-) 

The NNTPS-on-563 test, OTOH, works exactly like the existing NNTP test and seems to work fine. It was a hell of a lot easier to implement that part too.

Hope I didn't miss anything. First time doing this for a public project. Apparently the personal-itch theory is correct.

<click>
History
Date User Action Args
2010-11-02 08:38:35ajvantsetrecipients: + ajvant, janssen, pitrou, giampaolo.rodola, christian.heimes, chasonr, brian.curtin, jelie
2010-11-02 08:38:34ajvantsetmessageid: <1288687114.88.0.948001871059.issue1926@psf.upfronthosting.co.za>
2010-11-02 08:38:33ajvantlinkissue1926 messages
2010-11-02 08:38:32ajvantcreate