Documentation
¶
Overview ¶
Package httputil provides small HTTP helpers shared across handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetAttachmentFilename ¶
func SetAttachmentFilename(w http.ResponseWriter, filename string)
SetAttachmentFilename writes a Content-Disposition: attachment header that works across the spectrum of HTTP clients per RFC 6266 / RFC 5987.
For ASCII-only filenames, only the legacy quoted form is emitted. When the filename contains anything outside printable ASCII, both a sanitized ASCII fallback (filename=) and a percent-encoded UTF-8 form (filename*=) are emitted; per RFC 6266 §4.3 modern clients prefer filename* while legacy clients ignore the unknown parameter and use the ASCII fallback.
This matters for OPDS clients like KOReader's "Use server filenames" mode, which parses the header to name the downloaded file on the device.
Types ¶
This section is empty.