tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 47330] proposal : port of mod_remoteip in Tomcat as RemoteIpValve
Date Mon, 02 Nov 2009 21:17:08 GMT

Cyrille Le Clerc <> changed:

           What    |Removed                     |Added
  Attachment #24455|0                           |1
        is obsolete|                            |

--- Comment #5 from Cyrille Le Clerc <> 2009-11-02 13:17:01
UTC ---
Created an attachment (id=24465)
 --> (
Fixed Tomcat 7 patch with successful test case

Here is the fixed patch. A small mistake seems to have been introduced in the
test case during the refactoring.
Unfortunately, my "svn diff" command did not order the changed files in the
same order as the "24455: Tomcat 7 patch with completed TODOs and failing test
case" patch did.

For the Servlet API Filter implementation of this feature, there is some work
to port it from a valve because the HttpServletRequest interface does not ease
adding and removing http headers. 

To do this, I completely reimplemented the headers mechanisms with a case
insensitive list of headers rebuilt in a request wrapper. 

Another apporach could have been to decorate the getXxxHeader() and
getHeaderNames() methods. The getHeaderNames() method would be more complex
because we need to add headers (like x-forwarded-server) but also to remove
some (like x-forwarded-for). If this was an Iterator instead of an Enumeration,
I would use a predicate to exclude the "removed" headers, a FilterEnumeration
to apply the predicate on the Enumeration and a ChainIterator for the "added"
headers. This would imply reinventing a subset of Apache Commons Collection
applied to the old ages Enumeration.

Another point on the Filter port of the RemoteIpValve feature is the logging
implementation. Using Tomcat JULI would make reusing this Filter outside of
Tomcat more complex.

The version 1.0.0 of I linked on a previous comment of
this defect had a bug in the debug statement, here is a fixed version :

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message