Basic auth working, but realms not implemented; auth based on URI only.
Tidy up debug prints and comments