twisted/ldaptor — pull request #30 by cwaldbieser (2014-11-25 03:33:42+00:00)
Title: Added `proxybase.py`, an LDAP proxy that is easier to hook into.

Overriding `handleBeforeForwardRequest()` allows you to inspect/alter requests
going to the proxied server.
Overriding `handleProxiedResponse()` allows you to inspect/alter responses
going to the requesting client.

The CONTRIBUTING doc was a little light on details, so please bear with me if I am breaking conventions, guidelines, etc.

I had a hard time figuring out how you might go about using ldaptor.protocols.ldap.proxy to build an LDAP proxy server without reusing some of the private (leading underscore) methods. I rewrote parts of the code to make it seem a bit more straightforward to me, with specific methods to hook into for inspecting/modifying requests and responses.