Http function logic cleanups and comments.

Change-Id: Ibe309246960491958870610f69c253bf3ccc1637