Proper handling of 401 on HTTPS Basic Auth