'An override of L{IProtocol.dataReceived} that checks what protocol we\'re
using.'

def dataReceived(self, data):

    if (self._negotiatedProtocol is None):
        try:
            negotiatedProtocol = self._channel.transport.negotiatedProtocol
        except AttributeError:
            negotiatedProtocol = 'http/1.1'
        if (negotiatedProtocol is None):
            negotiatedProtocol = 'http/1.1'
        if (negotiatedProtocol == 'h2'):
            if (not H2_ENABLED):
                raise ValueError('Negotiated    HTTP/2    without    support.')
            self._channel._networkProducer.unregisterProducer()
            transport = self._channel.transport
            self._channel = H2Connection()
            self._channel.requestFactory = self._requestFactory
            self._channel.site = self._site
            self._channel.factory = self._factory
            self._channel.timeOut = self._timeOut
            self._channel.callLater = self._callLater
            self._channel.makeConnection(transport)
        else:
            assert (negotiatedProtocol == 'http/1.1'), 'Unsupported    protocol    negotiated'
        self._negotiatedProtocol = negotiatedProtocol
    return self._channel.dataReceived(data)
