tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Request for comments: Apache-like allow/deny remote host filtering
Date Tue, 04 Oct 2011 19:02:32 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Francis,

On 10/4/2011 2:50 PM, Francis GALIEGUE wrote:
> Patch attached. I didn't know Bugzilla would treat patches this
> way...

Can you give us a link to the bug?

> I implemented those two interfaces again, since the existing
> abstract class wouldn't fit the bill (it only tried regexes). Or
> maybe I don't understand what you actually mean?

I'll have to look at the base classes... I seem to recall a great deal
of extending and overriding in that package.

> Well, I need help precisely on the above... I have a hard time 
> figuring out how TestRemoteIP{Filter,Valve} work at all... But
> I've been only having a superficial glance at them so far.

The good thing is that you only have to do a very simple test harness.
Something like this:

FilterConfig config = .. // mock-up the filter config
FilterChain chain = .. // mock-up the filter chain
Filter filter = new RemoteAddrFilter();
filter.init(config);

HttpServletRequest request = ... // mock-up request
HttpServletResponse response = ... // mock-up response

foreach(ip in test_ips) {
  // request.setRemoteAddr(ip);
  filter.doFilter(request, response, chain);

  assertEquals(expected_status_code, response.getStatusCode());
}

Of course, you'll have to do some significant work to make sure that
the filter chain is mocked-up correctly and that your request object
can be programmed appropriately.

Perhaps that's what you were hoping to get some help doing? :)

If so, I'll keep going.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6LWEgACgkQ9CaO5/Lv0PCtLQCbBH+EHvUg6GwhgcL+RefS6f11
qPoAmwRZq7YY352W77bnpndfHdl4CyG4
=vTv7
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message