[Patches] [ python-Patches-1053365 ] nntplib: add support for NNTP
over SSL
SourceForge.net
noreply at sourceforge.net
Sun Dec 19 21:54:43 CET 2004
Patches item #1053365, was opened at 2004-10-24 20:41
Message generated for change (Comment added) made by rspsf
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1053365&group_id=5470
Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Reinhard Speyerer (rspsf)
Assigned to: Nobody/Anonymous (nobody)
Summary: nntplib: add support for NNTP over SSL
Initial Comment:
This patch adds support for NNTP over SSL to nntplib
(based on the SSL support recently added to poplib).
----------------------------------------------------------------------
>Comment By: Reinhard Speyerer (rspsf)
Date: 2004-12-19 20:54
Message:
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.
----------------------------------------------------------------------
Comment By: Jp Calderone (kuran)
Date: 2004-12-18 20:20
Message:
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.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1053365&group_id=5470
More information about the Patches
mailing list