Khask is a HTTP file server with a GridFS (MongoDB) backend, written in Haskell.
MongoDB includes a specification for storing large files, called GridFS. I've found it to be a pretty low-fuss way to get network-attached file storage.
There wasn't a nice way to serve those files to the web, so I wrote Khartoum (in Python). Then I started learning Go, and rewrote Khartoum in it as a learning exercise. The result was Khargo, which is a bit more polished than Khartoum ever was.
Khask is my rewrite of the same application in Haskell.
- Serving files from GridFS (duh).
- Setting the appropriate Content-Type header.
- Serving gzipped content to clients that support it.
- Setting the ETag header to the md5 of the file's content.
- CORS support. The Access-Control-Allow-Origin header is set to "*", so you can serve web fonts from khask without complaints from IE and Firefox.
The intended use case is as an origin server sitting behind a CDN. So your applications can store files in MongoDB, and they'll then be accessible from the web.
Here Be Dragons
Consider this alpha-quality software. Only run it in production if you're comfortable reading through the code and making changes.
- make sure we're getting the latest version of the file
- support RANGE requests
- Use http://www.stackage.org/haddock/lts-1.4/wai-conduit-126.96.36.199/Network-Wai-Conduit.html for real file streaming?