"Range" header, false otherwise (in which case range and length will not be set).
MessageHeaders.getRanges
bool getRanges(long totalLength, out soup.types.Range[] ranges)Parses hdrs's Range header and returns an array of the requested byte ranges.
The returned array must be freed with [soup.message_headers.MessageHeaders.freeRanges].
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 structRange, 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.
#SoupServer has built-in handling for range requests. If your server handler returns a [soup.types.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.types.Status.PartialContent] 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.
Parameters
totalLength | the total_length of the response body |
ranges | return location for an array of #SoupRange |