Name
http_sys_parse_ranges_header, http_sys_find_best_accept — parse HTTP Range headers and run content-type negotiation against Accept
Synopsis
any http_sys_parse_ranges_header(
|
in range_header varchar, |
in total_size integer); |
varchar http_sys_find_best_accept(
|
in accept_header varchar, |
in available_types any); |
Description
http_sys_parse_ranges_header parses an HTTP
Range header value (e.g.
'bytes=0-499,1000-1499') against a known
total_size and returns a vector of (start,
end) byte ranges normalized to that size. Out-of-range or
syntactically invalid ranges are dropped per RFC 7233.
http_sys_find_best_accept performs the server-side
half of HTTP content negotiation. Given an Accept
header value and a vector of MIME types the handler can produce, it
returns the type that maximises the client's quality value (q-factor), or
SQL NULL when none of the available types are acceptable to the client.
Pairs well with
langmatches_pct_http
for language negotiation.