Refactor proxy-enabled payload handling

This fixes a couple bugs and generally cleans up the proxy option parsing code. 
This sort of stuff is repeated a lot.  Can you move this to a `proxy_host` method that does it in one place?