Documentation
¶
Overview ¶
Package blobhttp serves vault files' contents by their hash over HTTP (ADR-0023): GET and HEAD <prefix><sha256>.<ext>, with the content type the extension names, a policy that keeps the bytes passive, immutable caching and one Range per request (docs/specs/rpc-protocol.md, Transports). The development gateway serves it at /blobs/, and the lodge app socket at /content/blobs/ (docs/specs/lodge-app.md#contentblobs).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentMAC ¶
ContentMAC names a blob in a keyed URL: HMAC-SHA256 of "frostnotes content\n" + its hash under key, in unpadded base64url (docs/specs/lodge-app.md#contentblobs). Without the key a page cannot make a file's URL, so it cannot learn whether a file it knows is there.
func ContentType ¶
ContentType returns the media type the app serves a vault file with, by its lower-cased extension (docs/design/app.md#attachments).
Types ¶
type Options ¶
type Options struct {
// Prefix is the path before a blob's name, such as "/blobs/".
Prefix string
// MaxRange is the most bytes a 206 carries: a longer range, or an
// open one, is cut to it.
MaxRange int64
// MaxWhole is the largest blob answered whole; a larger one without a
// Range is 413.
MaxWhole int64
// Download lets ?download=1 add Content-Disposition: attachment, for
// files a browser will not show in a sandboxed page.
Download bool
// Key, when set, makes paths <mac>/<sha256>.<ext>, the mac being
// ContentMAC under it; a path without the right one is 404.
Key []byte
}
Options configure a Handler. Zero limits are none.