This repository was archived by the owner on Jan 13, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -211,18 +211,24 @@ def connect(self):
211211
212212 self ._sock = BufferedSocket (sock , self .network_buffer_size )
213213
214- # We need to send the connection header immediately on this
215- # connection, followed by an initial settings frame.
216- sock .send (b'PRI * HTTP/2.0\r \n \r \n SM\r \n \r \n ' )
217- f = SettingsFrame (0 )
218- f .settings [SettingsFrame .ENABLE_PUSH ] = int (self ._enable_push )
219- self ._send_cb (f )
220-
221- # The server will also send an initial settings frame, so get it.
222- self ._recv_cb ()
214+ self ._send_preamble ()
223215
224216 return
225217
218+ def _send_preamble (self ):
219+ """
220+ Sends the necessary HTTP/2 preamble.
221+ """
222+ # We need to send the connection header immediately on this
223+ # connection, followed by an initial settings frame.
224+ self ._sock .send (b'PRI * HTTP/2.0\r \n \r \n SM\r \n \r \n ' )
225+ f = SettingsFrame (0 )
226+ f .settings [SettingsFrame .ENABLE_PUSH ] = int (self ._enable_push )
227+ self ._send_cb (f )
228+
229+ # The server will also send an initial settings frame, so get it.
230+ self ._recv_cb ()
231+
226232 def close (self ):
227233 """
228234 Close the connection to the server.
You can’t perform that action at this time.
0 commit comments