/// <since>4.1</since>
 /// <exception cref="Apache.Http.ProtocolException"></exception>
 protected internal virtual URI CreateLocationURI(string location)
 {
     try
     {
         URIBuilder b    = new URIBuilder(new URI(location).Normalize());
         string     host = b.GetHost();
         if (host != null)
         {
             b.SetHost(host.ToLower(CultureInfo.InvariantCulture));
         }
         string path = b.GetPath();
         if (TextUtils.IsEmpty(path))
         {
             b.SetPath("/");
         }
         return(b.Build());
     }
     catch (URISyntaxException ex)
     {
         throw new ProtocolException("Invalid redirect URI: " + location, ex);
     }
 }