Correct a bug in moving headers down a slot

During client encoding, inserting a new header caused the header stack
to be truncated after a single intermediate header.  Lots of functions
received additional checking while trying to identify the cause.