Missing User-Agent header results in NullPointerException

This pull requests contains a patch to avoid a NullPointerException when the User-Agent header is missing.