Skip to contents

Returns the configurable network limits the fetch engine applies per request. Each limit resolves from the matching argument, falling back to a getOption("sitemapr.*") value, then to the ADR-003 default. No limit is a non-overridable hard cap: a caller may raise any of them by passing an argument or setting the option.

Usage

fetch_limits(
  timeout = getOption("sitemapr.timeout", 30),
  max_redirects = getOption("sitemapr.max_redirects", 5L),
  max_bytes = getOption("sitemapr.max_bytes", 500L * 1024L^2)
)

Arguments

timeout

Per-request timeout in seconds (numeric).

max_redirects

Maximum number of redirects to follow (integer).

max_bytes

Per-resource safety ceiling in bytes (integer): the hard cap on the body read into memory. Exceeding it discards the body and raises a sitemapr_body_ceiling condition. Default 500 MB.

Value

A named list of limits with coerced types.

Details

Defaults (ADR-003 §3): request timeout 30 s, max redirects 5, per-resource safety ceiling 500 MB. The 50 MB sitemap-protocol size limit is NOT enforced here — it is a non-fatal validation finding (PROTOCOL_SIZE_EXCEEDED); the fetch layer only records body size and guards memory with the ceiling.

See also

index_limits() and discovery_limits() for the other bound constructors, and read_sitemap() which accepts limits.

Examples

fetch_limits()
#> $timeout
#> [1] 30
#> 
#> $max_redirects
#> [1] 5
#> 
#> $max_bytes
#> [1] 524288000
#> 
fetch_limits(timeout = 10, max_redirects = 3, max_bytes = 1024^2)
#> $timeout
#> [1] 10
#> 
#> $max_redirects
#> [1] 3
#> 
#> $max_bytes
#> [1] 1048576
#>