--keep-alive is not compatible with --proxy

This commit is contained in:
Bernardo Damele 2010-06-10 21:19:45 +00:00
parent 2835ad667e
commit c23ea4c749

View File

@ -96,7 +96,9 @@ def __urllib2Opener():
conf.cj = cookielib.LWPCookieJar()
handlers.append(urllib2.HTTPCookieProcessor(conf.cj))
if conf.keepAlive:
# Use Keep-Alive (persistent HTTP connection) only if a proxy is not set
# Reference: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html
if conf.keepAlive and not conf.proxy:
handlers.append(keepAliveHandler)
opener = urllib2.build_opener(*handlers)