Http utilities modified and moved to separate file.