Fixed #13285: populate_xheaders breaks caching

Tested on 2.7 and 3.3.