Merge: #11492: rewrite header folding algorithm.  Less code, more passing tests.