Fix #3976 - validate and normalize user-supplied URI for http_login.rb

URI should be validated and normalized before being used in an HTTP
request.
Land #3979, @wchen-r7 fixes #3976, http_login not using TARGETURI, neither uri normalization