support HTTP basic auth

This patch set depends on the DRY commits to be merged first, as it utilized the variables introduced there. Therefore review the DRY patch set first. I hope they simply vanish in this set once they are merged.