

def initiate_upgrade_connection(self, settings_header=None):
    '\n        Call to initialise the connection object for use with an upgraded\n        HTTP/2 connection (i.e. a connection negotiated using the\n        ``Upgrade: h2c`` HTTP header).\n\n        This method differs from :meth:`initiate_connection\n        <h2.connection.H2Connection.initiate_connection>` in several ways.\n        Firstly, it handles the additional SETTINGS frame that is sent in the\n        ``HTTP2-Settings`` header field. When called on a client connection,\n        this method will return a bytestring that the caller can put in the\n        ``HTTP2-Settings`` field they send on their initial request. When\n        called on a server connection, the user **must** provide the value they\n        received from the client in the ``HTTP2-Settings`` header field to the\n        ``settings_header`` argument, which will be used appropriately.\n\n        Additionally, this method sets up stream 1 in a half-closed state\n        appropriate for this side of the connection, to reflect the fact that\n        the request is already complete.\n\n        Finally, this method also prepares the appropriate preamble to be sent\n        after the upgrade.\n\n        .. versionadded:: 2.3.0\n\n        :param settings_header: (optional, server-only): The value of the\n             ``HTTP2-Settings`` header field received from the client.\n        :type settings_header: ``bytes``\n\n        :returns: For clients, a bytestring to put in the ``HTTP2-Settings``.\n            For servers, returns nothing.\n        :rtype: ``bytes`` or ``None``\n        '
    frame_data = None
    if self.client_side:
        f = SettingsFrame(0)
        for (setting, value) in self.local_settings.items():
            f.settings[self] = value
        frame_data = f.serialize()
        frame_data = base64.urlsafe_b64encode(frame_data)
    self.initiate_connection()
    connection_input = (ConnectionInputs.SEND_HEADERS if self.client_side else ConnectionInputs.RECV_HEADERS)
    self.state_machine.process_input(connection_input)
    self._begin_new_stream(stream_id=1, allowed_ids=AllowedStreamIDs.ODD)
    self.streams[1].upgrade(self.client_side)
    return frame_data

dataset/ETHPy150Open python-hyper/hyper-h2/h2/connection.py H2Connection.initiate_upgrade_connection/VarMisuse@55/616 `setting`->`self`