This is an implementation of the Strangler Fig pattern for any SMTP server program that can run under inetd(8) or tcpserver(1).
In this environment, client requests arrive on stdin
and server
responses go to stdout
.
io_strangler.py
sits in the command chain just before the
server program. It passes requests to the server and returns responses
to the client. This is pretty boring. But since it's written in Python,
not idiosyncratic old C, it's pretty easy to start handling certain
requests in a new way.
Not exactly like this image (by Christopher J. Wells, here), but almost:
- The legacy code to be strangled is a Unix command-line program
- Windows Subsystem for Linux might work; if you try, please let me know
$ cd .../where/you/put/source/trees
$ git clone https://github.com/schmonz/mess822
$ cd mess822
$ git checkout smtp-strangler
$ make ofmipd
$ cd .../where/you/put/source/trees
$ git clone https://github.com/schmonz/smtp-strangler
3. Configure PyCharm Community Edition
- Python interpreter for this project: any 3.x or 2.7
- Right-click and run
tests.py
: it should run without errors, skipping all tests - Right-click and run
io_strangler.py
- Run -> Edit Configurations -> Parameters needs to be
.../where/you/put/source/trees/mess822/ofmipd
- Run -> Edit Configurations -> Parameters needs to be
- Run
io_strangler.py
again and it should work interactively (tryHELP
,WORD UP
,QUIT
)