https_proxy: Move functions to common; reusable as a library.

Used to serve HTTPS in development mode for other programs.