Documentation
¶
Overview ¶
Package http provides HTTP utilities for fetching remote resources.
Index ¶
Constants ¶
View Source
const ( // UserAgentName is the application name used in the User-Agent header. UserAgentName = "tinct" // DefaultTimeout is the default HTTP request timeout. DefaultTimeout = 10 * time.Second // DefaultMaxResponseBytes is the maximum response body size (500 MB). // Prevents memory exhaustion from malicious or unexpectedly large responses. DefaultMaxResponseBytes int64 = 500 * 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FetchOptions ¶
type FetchOptions struct {
// Timeout specifies the HTTP request timeout.
// If zero, DefaultTimeout is used.
Timeout time.Duration
// Headers specifies additional HTTP headers to send with the request.
Headers map[string]string
// ProgressCallback is called periodically with download progress.
// Arguments are: bytesDownloaded, totalBytes (or -1 if unknown).
ProgressCallback func(current, total int64)
// MaxResponseBytes limits the maximum response body size.
// If zero, DefaultMaxResponseBytes is used.
// Set to -1 to disable the limit (not recommended).
MaxResponseBytes int64
}
FetchOptions configures HTTP fetch behavior.
Click to show internal directories.
Click to hide internal directories.