URL shortener, pastebin & file-sharing service, written from the ground up in C. https://r8r.be
 
 
 
 
 
Go to file
Jef Roosens c59dd29648
ci/woodpecker/push/build Pipeline was successful Details
ci/woodpecker/push/docker Pipeline failed Details
chore(lander): removed old networking code
2023-12-06 23:04:06 +01:00
.woodpecker feat(http): allow arbitrary number of response headers 2023-11-20 22:25:58 +01:00
bench
include feat(lander): full initial migration to lnm 2023-12-05 19:36:54 +01:00
landerctl chore: clean up makefiles a bit 2023-11-18 21:36:08 +01:00
lnm chore(lander): removed old networking code 2023-12-06 23:04:06 +01:00
lsm chore: please cppcheck 2023-11-18 22:28:50 +01:00
src chore(lander): removed old networking code 2023-12-06 23:04:06 +01:00
test
thirdparty
.dockerignore chore(lander): fix Docker build 2023-11-14 15:34:07 +01:00
.editorconfig
.gitignore
ARCHITECTURE.md
CHANGELOG.md chore(lander): updated changelog 2023-12-06 17:43:56 +01:00
Dockerfile chore(lander): fix Docker build 2023-11-14 15:34:07 +01:00
Makefile chore(lander): removed old networking code 2023-12-06 23:04:06 +01:00
README.md chore(lander): update readme 2023-11-19 13:25:09 +01:00
config.mk chore(lander): removed old networking code 2023-12-06 23:04:06 +01:00
docker-compose.yml

README.md

Lander

Lander is an HTTP/1.1 server that acts as a URL shortener, pastebin and file-sharing service. It's written from the ground up in C, complete with an HTTP framework built on top of an event loop implementation based on Build Your Own Redis with C/C++. Lookup of entries is done using an in-memory trie data structure, and on-disk storage uses a custom binary database format.

The codebase uses one thirdparty library, namely picohttpparser for parsing HTTP requests.

The idea

A URL shortener has always been on my list of things I'd like to write myself. It's simple, yet useful.

for our Algorithms & Datastructures 3 class, we had to implement three different tries (Patricia trie, ternary trie, and a custom one). Considering these are efficient string-based search trees, this gave me the idea to use it as the backend for a URL shortener!

The name

I gave up giving my projects original names a long time ago, so now I just use the names of my friends ;p

Benchmarking

I benchmark this tool using the wrk2 utility. I've provided two Lua scripts to aid with this. To bench publishing redirects, use the following:

wrk2 -s bench/post.lua -t 10 -R 10k -d30s -c32 http://localhost:18080

And to bench GET requests:

wrk2 -s bench/get.lua -t 10 -R 25k -d30s -c32 http://localhost:18080

Of course you're free to change the parameters, but the provided Lua files generate URLs that can be used in the benchmark.