Skip to content

io7m/pallene

Repository files navigation

pallene

Maven Central Maven Central (snapshot) Codecov

com.io7m.pallene

JVM Platform Status
OpenJDK (Temurin) Current Linux Build (OpenJDK (Temurin) Current, Linux)
OpenJDK (Temurin) LTS Linux Build (OpenJDK (Temurin) LTS, Linux)
OpenJDK (Temurin) Current Windows Build (OpenJDK (Temurin) Current, Windows)
OpenJDK (Temurin) LTS Windows Build (OpenJDK (Temurin) LTS, Windows)

Usage

pallene.jar \
  --address a \
  --port p \
  --chroot c \
  --file f \
  --group-id g \
  --user-id u \
  --mime-type m

The pallene.jar command reads the contents of f into memory, opens a socket s and binds it to address a, port p. It then chroots to directory c and switches to group ID g and user ID u. Then, for each client connection k on s, it reads and discards at most 1024 octets from k and then responds with an HTTP HTTP/1.0 200 OK response, serving the contents of f with MIME type m. It then closes k.

The command does NOT fork into the background; it is designed to run under a process supervision system and simply aborts with exit code 1 on any error. The command logs the addresses of connecting clients, but does not log any data or headers the clients send. The command only works on POSIX-compatible systems.

See the examples directory in this source repository for example scripts that can, for example, run the server in a memory-restricted Linux cgroup and run with GC settings optimized for tiny heaps.