Message6323

Author basti1302
Recipients basti1302
Date 2011-01-14.08:22:39
SpamBayes Score 8.073663e-05
Marked as misclassified No
Message-id <1294993360.01.0.56041773786.issue1697@psf.upfronthosting.co.za>
In-reply-to
Content
When trying to connect via httplib, like this

conn = httplib.HTTPConnection('localhost', 8080)
...
conn.request("GET", "/index.html", body, headers)

when there is nothing running on localhost:8080, a rather confusing error message is printed: 

"Only AF_INET sockets are currently supported on jython"

With the provided patch, the error message reads

"socket.error: (10061, 'Connection refused')"

which is what I would expect in this case.

IMHO when (whoever) decided to not support IPv6 he/she just overlooked this particular piece of code in httplib.py. As long as IPv6 is not supported, httplib should not use

socket.getaddrinfo(self.host, self.port, socket.AF_UNSPEC, socket.SOCK_STREAM)

(or socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM) which is the same) 

but instead should use 
 
socket.getaddrinfo(self.host, self.port, socket.AF_INET, socket.SOCK_STREAM)

This is related to Issue 1210.
History
Date User Action Args
2011-01-14 08:22:40basti1302setrecipients: + basti1302
2011-01-14 08:22:40basti1302setmessageid: <1294993360.01.0.56041773786.issue1697@psf.upfronthosting.co.za>
2011-01-14 08:22:39basti1302linkissue1697 messages
2011-01-14 08:22:39basti1302create