| Crates.io | memoryhttpd |
| lib.rs | memoryhttpd |
| version | 0.2.0 |
| created_at | 2023-03-10 15:51:39.992419+00 |
| updated_at | 2023-03-10 16:17:23.224192+00 |
| description | In-memory, multi-host HTTP server |
| homepage | |
| repository | https://codeberg.org/acatton/memoryhttpd |
| max_upload_size | |
| id | 806525 |
| size | 41,212 |
![]()
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: Thu, 09 Mar 2023 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: Thu, 09 Mar 2023 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: Thu, 09 Mar 2023 20:33:28 GMT
<
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
memoryhttpd can be used to store temporary tokens. For example using it as a
backend for /.well-known/acme-challenges/ for a reverse proxy.
This repository is mirrored on: