phax / ph-commons

Java 11 Library with tons of utility classes required in all projects
Apache License 2.0
30 stars 18 forks source link

HttpHeaderMap forces lower-case #11

Closed tsneed290 closed 6 years ago

tsneed290 commented 6 years ago

Hello! Been using your as2-lib library for sending AS2 messages and I'm loving it so far!

I had a question (or potential bug) about the HttpHeaderMap.getUnifiedName() method. It seems to be forcing lower-case when adding header values to the map.

While I agree that the HTTP spec says that header names are case-insensitive, I am dealing with a recipient (FDA ESG) that is case-sensitive with respect to header names. This forced me to modify ph-commons so that header names are not lower-cased prior to injection into the header map.

I'd like to propose that HttpHeaderMap is changed so that header names are not forcefully lower-cased when inserted into the map, while the lookups remain case-insensitive. I'd like to know your thoughts on this proposal; I wouldn't mind making a contribution for this change.

Thanks, Tim

phax commented 6 years ago

Point taken. Lowercasing by insertion was the most reasonable choice at the time of writing, because than the lowercasing needs to happen only once and not on every compare (equalsIgnoreCase) but if it makes problems in practice, I will of course modify it....

phax commented 6 years ago

Fixed in 9.1.8. I'm currently working myself through the AS2 4.2.0 release which contains some minor things I want to fix before releasing it. This will be one of it. So thanks for the heads up.

tsneed290 commented 6 years ago

Thank you @phax!