Basic Auth is broken - again...

This is most likely not the 'proper' way to do it, but it **works**.

Please test Basic Auth whenever refactoring the code. I don't know how many time is has been broken.

@icewind1991 @DeepDiver1975 @karlitschek