added range support to continue interrupted download

This commit is contained in:
Altair-sh
2026-11-06 20:57:37 +01:00
parent 2098082aa6
commit 0bfa5ed35c
6 changed files with 187 additions and 14 deletions
+19
View File
@@ -25,3 +25,22 @@ bin/servegp # reads ./serveg.toml
bin/servegp -config /etc/serveg/serveg.toml
```
## HTTP API
| Request | Result |
|---|---|
| `GET /share/dir/` | directory listing with an upload form if the share has `write_password` |
| `GET /share/file` | download file, supports `If-Modified-Since`, `Range` (single range) and `If-Range` (date) |
| `PUT /share/file` | upload: 201 created, 200 replaced |
| `OPTIONS /share/file` with `X-Upload-Size: <size>` | upload check, same as PUT but without body |
Passwords use HTTP Basic auth, the user name is ignored:
```sh
curl -O http://localhost:8080/public/file.zip
curl -C - -O http://localhost:8080/public/file.zip # continue interrupted download
curl -u :password -T file.zip http://localhost:8080/public/file.zip
```
Error responses explain the reason in a plain text body.