Consolidate code for HTTP servers.