>     public AuthenticationResponse apply(HttpResponse from) {
>        releasePayload(from);
> -      Builder<String, URI> builder = ImmutableMap.builder();
> -      for (Entry<String, String> entry : from.getHeaders().entries()) {
> -         if (entry.getKey().endsWith(URL_SUFFIX))
> -            builder.put(entry.getKey(), getURI(entry.getValue()));
> +
> +      // HTTP headers are case in-sensitive (RFC 2616) so we must allow for 
> that when looking an header names for the URL keyword
> +      //FIXME When Apache commons-collections 4 is out of Snapshot it will 
> provide generics for CaseInsensitiveMap 
> +      final CaseInsensitiveMap services = new CaseInsensitiveMap();
> +      for (final Entry<String, String> entry : from.getHeaders().entries()) {
> +         if (entry.getKey().toLowerCase().endsWith(URL_SUFFIX.toLowerCase()))
> +            services.put(entry.getKey(), getURI(entry.getValue()));

Would the following (avoiding the case insensitive map) not work here?
```
Builder<String, String> services = ImmutableMap.builder()
for (Entry<String, String> entry : from.getHeaders().entries()) {
  String lowerCaseKey = entry.getKey().toLowerCase();
  if (lowerCaseKey.endsWith(URL_SUFFIX.toLowerCase()) { // perhaps add a 
URL_SUFFIX_LOWER constant?
    services.put(lowerCaseKey, getURI(entry.getValue()).toLowerCase());
  }
...
Obviously, this will differ in that the map will not have case-insensitive 
_comparison_, simply lowercase-only entries.

@everett-toews: any idea where, if anywhere, the _usage_ of this map would need 
to be modified to be case-insensitive?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/76/files#r5466201

Reply via email to