Date: 2025-03-10
Simple Spartan web and mail server in Perl
------------------------------------------
As I mentioned earlier, I was not satisfied with web and mail servers.
HTTP - web proxy to NEX kinex was relatively simple, but it was still
huge Go nonsense. Mail server was OpenSMTPD, I think it's over 80
thousands lines of code. OpenSMTPD was something like 10 megabytes in
RAM. That's a lot of code traveling around machine.
As a humble Perl monk, I went into a Perl monastery and prayed for
simple Perl replacement for both. Perl God heard me and fulfilled my
prayer wishes. They are pretty simple, but they get the job done.
Web server is practically NEX to HTTP proxy, that takes plain text
files written for NEX/Gopher. It escapes HTML special characters,
wraps plain text into HTML, adds few necessary headers and things
around. Then it serves content over port 80 for the public.
SMTP server, or probably more correct MTA (Mail Transfer Agent) is
very primitive, it practically just interactively communicates with
other mail servers, accepts messages and saves them as files. It does
nothing else. The only additional feature for this mail server is that
it logs whole process and get the IP addresses of clients.
/bin/web.pl HTTP web server in Perl
/bin/mal.pl SMTP mail server in Perl with logging
Both Perl programs are true Spartan in design and functions. They just
do what they should and nothing else. True Unix computing.
----------------------------------------------------------------------
The best code is no code at all.