Developer notes for cproxy-mp


cproxy-mp is a reimplementation of the old cproxy, as a metaproxy module.


Environment
-----------

To work, it needs a metaproxy installation, for developers most likely a
git checkout. The script .../cproxy-mp/sr/fetchall.sh will do a git checkout
of all the required packages, compile them, and run tests. If that works, you
should have a good development environment. If not, try to run with the 
argument "clean" to do a make clean everywhere first.

The filter can not live alone, usually we need also
 * cproxyrewrite_filter for actually rewriting http content
 * httpclient_filter for fetching the web pages
These are part of the regular metaproxy git project.

Of course there has to be a cf engine somewhere too, to produce sessions and
proxified links for us to proxy. It can live in the same metaproxy installation
as the cproxy, or separately, as long as they can share the session files, and
the config file (typically /etc/cf-proxy/cproxy.cfg)


Tests
-----

There is a test program, test_filter_cproxy.cpp. It runs unit tests for the 
cproxy filter alone, and in a more complext chain of filters that ends with
serving local files. All this is set up from inside the test program, there
are no config files. But the test program does produce a few debug dump 
directories, since it needs to test the production of those.

Running 'make check' in the cproxy-mp main directory runs the tests.

There is also a test setup test/e2test that I use for setting things up on 
ebsco2, where I can test with a real-life engine and real connectors.


Source
------

The source is in one large file, filter_cproxy.cpp (and its header file,
filter_cproxy.hpp). The source file is divided into sections
 * Definitions
 * Helpers (mostly about debug information)
 * Session handling
 * Request mangling
 * Postprocessing the response
 * Process function - this is what metaproxy calls for every request
 * Configuration stuff - configure() is what mp calles once in startup
 * Housekeeping
 * Some additional comments about cookies

The main classes are
 * CProxy - the filter itself, visible to metaproxy
 * CProxy::Rep - the internal representation of the filter. One per metaproxy
 * CProxy::Handle - handle for one HTTP request
and a few helper classes inside the Handle, for cookies, custom replace rules, etc.


Documentation
-------------
There is some documentation under the doc directory. also README and whatnext.txt
in the main directory can be helpful.


Packaging
---------

There are packaging files for CentOs and Debian. See our packaging guidelines at
https://twiki.indexdata.com/twiki/bin/view/ID/AdamsReleaseProcedure 





