def on_response(self, response):
        if not self.ssl or self.bridge or self.injected_server:
            return response
        response = self.buffer + response
        self.buffer = ""
        try:
            index = 0
            while index < len(response):
                record, size = TlsRecord.from_stream(response[index:])
                version = record.version
                for i, message in enumerate(record.messages):
                    # Inject the CCS right after the ServerHello
                    if (isinstance(message, tls.types.HandshakeMessage)
                           and message.type == HandshakeMessage.TYPE.SERVER_HELLO):
                        response = (response[:index] +
                                self._inject_ccs(record, i) +
                                response[index+size:])
                        self.injected_server = True
                        return response

                index += size

        except __HOLE__:
            # Failed to parse TLS, this is probably due to a short read of a TLS
            # record. Buffer the response to try and get more data.
            self.buffer = response
            # But don't buffer too much, give up after 16k.
            if len(self.buffer) > 2**14:
                response = self.buffer
                self.buffer = ""
                return self.buffer
            return ""
        return response
dataset/ETHPy150Open google/nogotofail/nogotofail/mitm/connection/handlers/connection/ccs.py/EarlyCCS.on_response