Parses this's Range header and returns an array of the requested byte ranges.
The returned array must be freed with [[email protected]_ranges].
If total_length
is non-0, its value will be used to adjust the returned ranges to have explicit start and end values, and
the returned ranges will be sorted and non-overlapping. If total_length
is 0, then some ranges may have an end value of -1,
as described under [struct@Range], and some of the ranges may be redundant.
Beware that even if given a total_length
, this function does not check that the ranges are satisfiable.
Server has built-in handling for range requests. If your server handler returns a soup_status_ok response containing the complete response body (rather than pausing the message and returning some of the response body later), and there is a Range header in the request, then libsoup will automatically convert the response to a soup_status_partial_content response containing only the range(s) requested by the client.
The only time you need to process the Range header yourself is if either you need to stream the response body rather than returning it all at once, or you do not already have the complete response body available, and only want to generate the parts that were actually requested by the client.
this | |
total_length |
the total_length of the response body |
ranges |
return location for an array of Range |
length |
the length of the returned array |
true if this contained a syntactically-valid "Range" header,
false otherwise (in which case |