edwin/edwin.org

1.1 KiB

Edwin, a Gemini server in POSIX AWK (with some other bits)

Foreword

Sort of on a whim, and sort of because the only programming languages I'm really comfortable in are shell and awk, I've decided to write a Gemini server in those languages. I've already written a Gemini browser in bash (or written most of one; I still need to add some bits for quality-of-life improvements) for much of the same reasons, so I always knew that there would come a day when I'd need to write something for the other end of the pipe. It turns out, today is that day.

What follows is a literate Org file containing a functioning Gemini server that's as POSIX-compatible as possible. Awk handles the textual parts of the request and response, but since it can't do networking (and even GNU awk can't do TLS), I'm wrapping that core logic in a call to socat in a shell script. A dream of mine is to shoehorn Make in as a multiplexer, but I'm not sure if it's possible or even necessary. Let's find out!!

Requirements

Basics

URL parsing