Add more common code for HTTP handling, and detecting missing required resources.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>