Extract header manipulation into a helper and add test

Ribbon and simple host reverse proxy now share quite a lot of
code (everything to do with headers).

Fixes gh-103