'This is a quick and dirty way of responding to bad requests.
As described by HTTP standard we should be patient and accept the
whole request from the client before sending a polite bad request
response, even in the case when clients send tons of data.
Unlike in the HTTP/1.1 case, this does not actually disconnect the
underlying transport: there\'s no need. This instead just sends a 400
response and terminates the stream.
@param streamID: The ID of the stream that needs the 100 Continue
response
@type streamID: L{int}'

def _respondToBadRequestAndDisconnect(self, streamID):

    headers = [(':status', '400')]
    self.conn.send_headers(headers=headers, stream_id=streamID, end_stream=True)
    self.transport.write(self.conn.data_to_send())
    stream = self.streams[streamID]
    stream.connectionLost(ConnectionLost('Invalid    request'))
    self._requestDone(streamID)
