@@ -27,7 +27,7 @@ class HTTP20Connection(object):
2727 This object behaves similarly to the Python standard library's
2828 HTTPConnection object, with a few critical differences.
2929 """
30- def __init__ (self , host , port = None , ** kwargs ):
30+ def __init__ (self , host , port = None , * , window_manager = None , * *kwargs ):
3131 """
3232 Creates an HTTP/2.0 connection to a specific server.
3333
@@ -39,6 +39,12 @@ def __init__(self, host, port=None, **kwargs):
3939 ``'twitter.com'``, ``'twitter.com:443'`` or ``'127.0.0.1'``.
4040 :param port: (optional) The port to connect to. If not provided and one
4141 also isn't provided in the ``host`` parameter, defaults to 443.
42+ :param window_manager: (optional) The class to use to manage flow
43+ control windows. This needs to be a subclass of the
44+ :class:`BaseFlowControlManager <hyper.http20.window.BaseFlowControlManager>.
45+ If not provided,
46+ :class:`FlowControlManager <hyper.http20.window.FlowControlManager>`
47+ will be used.
4248 """
4349 if port is None :
4450 try :
@@ -50,6 +56,7 @@ def __init__(self, host, port=None, **kwargs):
5056 self .host , self .port = host , port
5157
5258 # Create the mutable state.
59+ self .__wm_class = window_manager or FlowControlManager
5360 self .__init_state ()
5461
5562 return
@@ -93,8 +100,8 @@ def __init_state(self):
93100 self ._out_flow_control_window = 65535
94101 self ._in_flow_control_window = 65535
95102
96- # Create the window manager.
97- self .window_manager = FlowControlManager (65535 )
103+ # Instantiate a window manager.
104+ self .window_manager = self . __wm_class (65535 )
98105
99106 return
100107
0 commit comments