Begin adding proxy support,

Refs #21
Refactor.

Refs #21
Make authentication work.

Refs #21
Better fallback when no password specified.

Refs #21