Commit a130025d authored by Denis Bilenko's avatar Denis Bilenko

fix Issue 71: gevent.httplib doesn't support HTTPSConnection. Patch by snb at spotify.

parent 2559aceb
# Copyright (C) 2010-2011 gevent contributors. See LICENSE for details.
__httplib__ = __import__('httplib')
# Get the standard Python httplib as __httplib__, ensuring we get a version
# that hasn't already been modified by monkey patching of any of its members.
# HTTPSConnection must use the standard HTTPConnection because libevent-http
# does not currently support https.
import imp
__httplib__ = imp.load_module('__httplib__', *imp.find_module('httplib'))
from gevent import core
from gevent.hub import Waiter, get_hub
......@@ -10,6 +16,7 @@ __implements__ = [
]
__imports__ = [
'HTTPSConnection',
'HTTPException',
'InvalidURL',
]
......@@ -19,6 +26,7 @@ __all__ = __implements__ + __imports__
InvalidURL = __httplib__.InvalidURL
HTTP_PORT = __httplib__.HTTP_PORT
HTTPException = __httplib__.HTTPException
HTTPSConnection = __httplib__.HTTPSConnection
EV_METHOD_TYPES = dict((name, id) for (id, name) in core.HTTP_method2name.items())
......
......@@ -180,9 +180,10 @@ def patch_select(aggressive=False):
def patch_httplib():
from gevent.httplib import HTTPConnection
httplib = __import__('httplib')
from gevent.httplib import HTTPConnection, HTTPSConnection
httplib.HTTPConnection = HTTPConnection
httplib.HTTPSConnection = HTTPSConnection
def patch_all(socket=True, dns=True, time=True, select=True, thread=True, os=True, ssl=True, httplib=False, aggressive=True):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment