[Patches] [ python-Patches-1053365 ] nntplib: add support for NNTP over SSL

SourceForge.net noreply at sourceforge.net
Sat Dec 18 21:20:02 CET 2004


Patches item #1053365, was opened at 2004-10-24 16:41
Message generated for change (Comment added) made by kuran
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: Jp Calderone (kuran)
Date: 2004-12-18 15: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