'Enforces a limit of C{HTTPChannel.totalHeadersSize}
on the size of headers received per request starting from initial
command line.'

def test_headersTooBigInitialCommand(self):

    processed = []
    class MyRequest(http.Request, ):
        def process(self):
            processed.append(self)
            self.finish()
    channel = http.HTTPChannel()
    channel.totalHeadersSize = 10
    httpRequest = 'GET    /path/longer/than/10    HTTP/1.1\n'
    channel = self.runRequest(httpRequest=httpRequest, requestFactory=MyRequest, channel=channel, success=False)
    self.assertEqual(processed, [])
    self.assertEqual(channel.transport.value(), 'HTTP/1.1    400    Bad    Request\r\n\r\n')
