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.

classification
Title: nntplib - python 2.5
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: morrowc, vstinner
Priority: normal Keywords: patch

Created on 2008-12-30 06:12 by morrowc, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
nntplib.py-ipv6.patch morrowc, 2008-12-30 06:12 diff -U3 for stock nntplib vs patched nntplib
Messages (2)
msg78509 - (view) Author: Chris Morrow (morrowc) Date: 2008-12-30 06:12
nntplib.py on python2.5 is not IPv6 ready. The below patch at least 
makes connections on both ipv4 and ipv6 to servers.

This was taken out of bug: http://bugs.python.org/issue1664

if that helps...

platform: 
Linux hostnamehere 2.6.26.6-79.fc9.i686 #1 SMP Fri Oct 17 14:52:14 EDT 
2008 i686 i686 i386 GNU/Linux


morrowc@tweezer:/tmp$ diff -U3 nntplib.py.orig nntplib.py
--- nntplib.py.orig     2008-12-30 01:06:14.000000000 -0500
+++ nntplib.py  2008-12-30 01:07:33.000000000 -0500
@@ -109,8 +109,19 @@
         """
         self.host = host
         self.port = port
-        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        self.sock.connect((self.host, self.port))
+        msg = "getaddrinfo returns an empty list"
+        for res in socket.getaddrinfo(self.host, self.port, 0, 
socket.SOCK_STREAM):
+          af, socktype, proto, canonname, sa = res
+          sock = None
+          try:
+            self.sock = socket.socket(af, socktype, proto)
+            self.sock.connect(sa)
+
+          except error, msg:
+            if self.sock is not None:
+                self.sock.close()
+            raise NNTPError, msg
+
         self.file = self.sock.makefile('rb')
         self.debugging = 0
         self.welcome = self.getresp()
msg78580 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2008-12-31 00:22
Python 2.5 branch doesn't accept bugfix anymore, only 
security issues. See #1664 for python 2.6+ and 3.0+.
History
Date User Action Args
2022-04-11 14:56:43adminsetgithub: 49027
2008-12-31 00:22:01vstinnersetstatus: open -> closed
resolution: wont fix
messages: + msg78580
nosy: + vstinner
2008-12-30 06:12:15morrowccreate