def _cobra_http_getsock(self):
thr = currentThread()
tsocks = getattr(thr, 'cobrahttpsocks', None)
if tsocks == None:
tsocks = {}
thr.cobrahttpsocks = tsocks
sock = tsocks.get(self._cobra_slookup)
if not sock or sock.trashed:
# Lets build a new socket... shall we?
sock = self._cobra_http_newsock()
# If we have authinfo lets authenticate
authinfo = self._cobra_kwargs.get('authinfo')
if authinfo != None:
sock.authUser(authinfo)
tsocks[self._cobra_slookup] = sock
return sock
评论列表
文章目录