Description
Web server that serves files from a SQLite database.
Features:
- fast (very low latency)
- supports gzip compression
- supports up to 3000 requests per second
- Although SQLite lookup speeds probably dramatically limit this in realistic scenarios
- ability to write to the database with a
POST
request
- You are able to use a script to, for any web page you visit, cache the page by clicking a button
Bugs:
- large files (above around 500KB) should be saved as files and inserted via specifying the filepath, they should not be uploaded
- This is because the server cannot handle large incoming requests - there is some as-yet-unidentified bug
Missing features:
- No HTTPS
- If you require this, run it behind a reverse proxy like nginx
- Does not respect CORS headers
- Currently, CORS headers are written for maximum security - thus many assets do not load except in
local-only mode
Compiling
Prerequisites:
- libz.h
- Installed with
libz-dev
or zlib1g-dev
- sqlite3.c
- Or you can modify the compile instructions to use
libsqlite0-dev
- libycompsky
- Any modern C++ compiler
Usage
Server
[/path/to/sqlite.db] [PORT] [MAX_CONTENT_SIZE_IN_MB] [MODE]
MODE can be:
- ro (read-only)
- rw (read-write)
Command line
Example:
Browser
Greasemonkey/Tampermonkey scripts:
baseline
- Adds a 'copy to clipboard' button to all websites, so you can cache the HTML contents (only HTML) with just a couple of clicks
- The web pages would look exactly like their normal versions if CORS headers were respected; currently however this is not the case
local-only mode
- Rewrites cached pages (via client-side JS) to only load assets from the WebCache server
- To make a website look like its original, you must usually cache all of its assets too (CSS, JavaScript, images, JSON...)
Example: