improve Headers.iter

This code is currently used in the servo branch, forgot to make a PR to master.
same here as on downcast_mut