Extract basic auth from URL

Fixes #128

I'm open for suggestions how to change this code if it does not suit your coding style.

P.S.: You should really set your editors to remove trailing whitespaces :confused: