MessageHeaders.getRanges

Parses @hdrs's Range header and returns an array of the requested byte ranges. The returned array must be freed with soup_message_headers_free_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 #SoupRange, 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.

<note><para> #SoupServer 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. </para></note>

class MessageHeaders
bool
getRanges
(,
out SoupRange[] ranges
)

Parameters

totalLength long

the total_length of the response body

ranges SoupRange[]

return location for an array of #SoupRange

Return Value

Type: bool

%TRUE if @hdrs contained a syntactically-valid "Range" header, %FALSE otherwise (in which case @range and @length will not be set).

Meta

Since

2.26