content_range()
public
Returns a Range object which represents the value
of the Content-Range: header field. For a partial entity body, this
indicates where this fragment fits inside the full entity body, as range of byte offsets.
Show source
def content_range
return nil unless @header['content-range']
m = %<bytes\s+(\d+)-(\d+)/(\d+|\*)>.match(self['Content-Range']) or
raise Net::HTTPHeaderSyntaxError, 'wrong Content-Range format'
m[1].to_i .. m[2].to_i
end