acatton/memoryhttpd
1
0
Fork
You've already forked memoryhttpd
0
HTTP Server with its resources stored in memory.
  • Rust 100%
Find a file
Antoine Catton f8eb538087 Remove the maximum amount of features
This aims at reducing the size of the binary by removing un-necessary
code.
2023年03月10日 17:10:56 +01:00
.resources Add icon to the README. 2023年03月09日 22:41:50 +01:00
src Remove the maximum amount of features 2023年03月10日 17:10:56 +01:00
.gitignore Initial commit 2023年03月09日 20:19:35 +01:00
Cargo.lock Remove the maximum amount of features 2023年03月10日 17:10:56 +01:00
Cargo.toml Remove the maximum amount of features 2023年03月10日 17:10:56 +01:00
LICENSE Release under ISC license 2023年03月10日 16:39:35 +01:00
README.md Add list of mirrors to the readme 2023年03月10日 16:37:59 +01:00

memoryhttpd

memoryhttpd Icon

memoryhttpd is an in-memory HTTP server. Resources can be added by using PUT. It supports multiple hosts.

For example:

$ curl -v http://localhost:3000/foo/bar/ -H Host:example.com -X PUT -d 'hello world'
> PUT /foo/bar/ HTTP/1.1
> Host:example.com
> Content-Length: 11
> 
< HTTP/1.1 200 OK
< x-memoryhttpd-action: set
< content-length: 11
< date: 2023年3月09日 20:32:07 GMT
< 
hello world
$ curl -v http://localhost:3000/foo/bar/ -H Host:example.com
> GET /foo/bar/ HTTP/1.1
> Host:example.com
> 
< HTTP/1.1 200 OK
< content-length: 11
< date: 2023年3月09日 20:33:22 GMT
< 
hello world
$ curl -v http://localhost:3000/foo/bar/ -H Host:example.net
> GET /foo/bar/ HTTP/1.1
> Host:example.net
> User-Agent: curl/7.85.0
> Accept: */*
> 
< HTTP/1.1 404 Not Found
< content-length: 0
< date: 2023年3月09日 20:33:28 GMT
< 

Commands

Set a value:

PUT /full/path HTTP/1.1
Host: hostname
Content-Length: 5
value

Get a value:

GET /full/path HTTP/1.1
Host: hostname

Delete a value:

DELETE /full/path HTTP/1.1
Host: hostname

Set with an expiration (in milliseconds):

PUT /full/path HTTP/1.1
Host: hostname
X-Expire-ms: 30000
Content-Length: 21
value expiring in 30s

Use cases

acme challenges

memoryhttpd can be used to store temporary tokens. For example using it as a backend for /.well-known/acme-challenges/ for a reverse proxy.

Mirrors

This repository is mirrored on: