Closed as not planned
Description
Hello Spring maintainers,
I've found a bug in the NettyHeadersAdapter
that causes it to duplicate header values when the string case is mixed up between entries.
This arises because the adapter iterates through the underlying entries using a case-insensitive method to get the values.
DefaultHttpHeaders headers;
for (var n : headers.names()) { <-- case sensitive
for (var v : headers.getAll(n)) { <-- case insensitive
System.out.println(n + "=" + v);
}
}
I've reproduced this on 6.2.0
Reproducer:
var headers = new DefaultHttpHeaders();
var adapter = new Netty5HeadersAdapter(headers); // Also with Netty4
adapter.add("foo-bar", "one");
adapter.add("Foo-Bar", "two");
adapter.add("fOO-bar", "three");
for (var e : adapter.entrySet()) {
System.out.println(e.getKey() + "=" + e.getValue());
}
/*
Output:
foo-bar=[one, two, three]
Foo-Bar=[one, two, three]
fOO-bar=[one, two, three]
*/