classification
Title: nntplib: add support for NNTP over SSL
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: duplicate
Dependencies: Superseder: NNTPS support in nntplib
View: 1926
Assigned To: Nosy List: BreamoreBoy, pitrou, rspsf
Priority: normal Keywords: patch

Created on 2004-10-24 20:41 by rspsf, last changed 2010-09-07 15:18 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
nntplib.patch rspsf, 2004-10-24 20:41 nntplib SSL patch
Messages (5)
msg47126 - (view) Author: Reinhard Speyerer (rspsf) Date: 2004-10-24 20:41
This patch adds support for NNTP over SSL to nntplib
(based on the SSL support recently added to poplib).
msg47127 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2004-12-18 20:20
Logged In: YES 
user_id=366566

I wonder why NNTP_SSL.getline() uses a regular expression to
find a newline.  Wouldn't it be simpler and more efficient
to rewrite the method like this (untested, but I bet it
works, and hopefully it gets the idea across anyway):

|  def getline(self):
|      newline = self.buffer.find('\n')
|      while newline == -1:
|          self._fillBuffer()
|          newline = self.buffer.find('\n')
|      line = self.buffer[:newline]
|      self.buffer = self.buffer[newline + 1:]
|      if line.endswith('\r'):
|          line = line[:-1]
|      return line

Also, wouldn't it be nice if the line handling code here
weren't a duplicate of the line handling code in at least
two other stdlib modules?  I don't mean to single out this
patch, but maybe instead of compounding the problem, this
could be taken as an opportunity to reduce the code
duplication in this area by doing some refactoring of the
various line-based protocol implementations to share code
for this common requirement.
msg47128 - (view) Author: Reinhard Speyerer (rspsf) Date: 2004-12-19 20:54
Logged In: YES 
user_id=814251

NNTP_SSL.getline() uses a regular expression because the
NNTP_SSL code is a rather straightforward port of the
corresponding
SSL code from the poplib.py module.

I think it is a good idea to refactor the code to avoid code
duplication
in the various modules using SSL (and maybe also for the
different
authentication methods like AUTH CRAM_MD5 etc.), however
such a large refactoring is probably beyond the scope of a
submitted patch.



msg114384 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-19 17:55
Can someone provide an updated unit test to accompany the code patch.
msg115772 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-09-07 15:18
The patch in #1926 is more modern and up-to-date, closing as duplicate.
History
Date User Action Args
2010-09-07 15:18:15pitrousetstatus: open -> closed

superseder: NNTPS support in nntplib

nosy: + pitrou
messages: + msg115772
resolution: duplicate
stage: test needed ->
2010-08-19 17:55:36BreamoreBoysetnosy: + BreamoreBoy

messages: + msg114384
versions: + Python 3.2, - Python 2.7
2009-02-14 20:12:41exarkunsetnosy: - exarkun
2009-02-14 18:19:24ajaksu2setstage: test needed
type: enhancement
versions: + Python 2.7
2004-10-24 20:41:04rspsfcreate