fixed KeyError when accessing header dictionary. if key not present they use default value of space so that the username/password dialog will display