'L{HTTPChannel} enforces the limit of C{HTTPChannel.maxHeaders} per
request so that headers received in an earlier request do not count
towards the limit when processing a later request.'

def test_headerLimitPerRequest(self):

    processed = []
    class MyRequest(http.Request, ):
        def process(self):
            processed.append(self)
            self.finish()
    self.patch(http.HTTPChannel, 'maxHeaders', 1)
    requestLines = ['GET    /    HTTP/1.1', 'Foo:    bar', '', '', 'GET    /    HTTP/1.1', 'Bar:    baz', '', '']
    channel = self.runRequest('\n'.join(requestLines), MyRequest, 0)
    [first, second] = processed
    self.assertEqual(first.getHeader('foo'), 'bar')
    self.assertEqual(second.getHeader('bar'), 'baz')
    self.assertEqual(channel.transport.value(), 'HTTP/1.1    200    OK\r\nTransfer-Encoding:    chunked\r\n\r\n0\r\n\r\nHTTP/1.1    200    OK\r\nTransfer-Encoding:    chunked\r\n\r\n0\r\n\r\n')
