httputil

package
v0.0.49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 3 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL