Tidy up of some HTTP handling.