maxfortun opened a new pull request, #893:
URL: https://github.com/apache/tomcat/pull/893

   There is a very old Bugzilla issue for this already 
[58464](https://bz.apache.org/bugzilla/show_bug.cgi?id=58464).
   
   If you think of tomcat as an app by itself, and not as a part of a larger 
ecosystem of apps, it may be ok to claim that tomcat is opinionated on the 
subject of keeping all the headers lower cased. However, in enterprise 
environments, like my own, there are hundreds of apps all talking to one 
another, especially if async pipelines, like the ones powered by activemq or 
kafka, are involved. In this case preserving access to the original header 
spelling may be important, as there are maybe hundreds of legacy applications 
that are not ready to be refreshed to fully support lower cased headers yet. 
Yes, it is 2025, and yes, it is still relevant. Legacy is legacy. It would be 
nice if tomcat offered access to the original spelling of the headers. While 
http1 spec does require case agnostic treatment, it doesn't require losing 
original spelling of the http headers. I am proposing to move case processing 
from the [Http11InputBuffer]() into its own 
[valve](https://github.com/maxfortun/tomcat
 
/blob/feature/retain_original_header_spelling/java/org/apache/catalina/valves/LowerCaseHeadersValve.java),
 and have it included into the [default 
configuration](https://github.com/maxfortun/tomcat/blob/e2904f7f7f9be667099462505164f54a90b80f40/conf/server.xml#L164).
 This should retain full backward compatibility to current deployments and 
actually allow tomcat users that do require original spelling to access it via 
something like this:
   ```java
       public static Map<String, List<String>> 
getOriginalHeaders(HttpServletRequest httpServletRequest) {
           Map<String, List<String>> originalHeaders = (Map<String, 
List<String>>) httpServletRequest.getAttribute("originalHeaders");
   
           if (originalHeaders != null) {
               if(logger.isDebugEnabled()) {
                   originalHeaders.forEach((name, values) -> {
                       logger.debug(name + " = " + values);
                   });
               }
           } else {
               logger.debug("No original headers");
           }
   
           return originalHeaders;
       }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to