NAME
HTTP::Promise::Headers::Range - Range Header Field
SYNOPSIS
use HTTP::Promise::Headers::Range;
my $range = HTTP::Promise::Headers::Range->new ||
die( HTTP::Promise::Headers::Range->error, "\n" );
$range->unit( 'bytes' ):
$range->ranges->push( $range->new_range( 200, 1000 ) );
my $start = $range->ranges->first->start; # 200
my $end = $range->ranges->first->end; # 1000
$range->ranges->push( $range->new_range( 1001, 2000 ) );
say $range->as_string;
# or
say "$range";
# bytes=200-1000, 1001-2000
VERSION
v0.1.0
DESCRIPTION
The following is an extract from Mozilla documentation.
The Range HTTP request header indicates the part of a document that the server should return.
Example:
# Getting multiple ranges
Range: bytes=200-1000, 2000-6576, 19000-
# The last 500 bytes
Range: bytes=0-499, -500
Range: bytes=200-
Range: bytes=200-1000
Range: bytes=200-1000, 1001-2000
Range: bytes=200-1000, 1001-2000, 2001-3000
Range: bytes=-4321
METHODS
as_string
Returns a string representation of the Range
object.
new_range
Provided with a start and and offset, and this will return a new HTTP::Promise::Headers::Range::StartEnd
object.
This object has two methods: start
and end
each capable of setting or returning its value, which may be undef
ranges
Sets or gets the array object that contains all the HTTP::Promise::Headers::Range::StartEnd
objects (see below for a descriptions). Thus you can use all the methods from Module::Generic::Array to manipulate the range objects.
unit
The unit in which ranges are specified. This is usually bytes
.
HTTP::Promise::Headers::Range::StartEnd
end
Sets or gets the end of the range as a number object
start
Sets or gets the start of the range as a number object
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
See also rfc7233, section 3.1 and Mozilla documentation
HTTP::Promise, HTTP::Promise::Request, HTTP::Promise::Response, HTTP::Promise::Message, HTTP::Promise::Entity, HTTP::Promise::Headers, HTTP::Promise::Body, HTTP::Promise::Body::Form, HTTP::Promise::Body::Form::Data, HTTP::Promise::Body::Form::Field, HTTP::Promise::Status, HTTP::Promise::MIME, HTTP::Promise::Parser, HTTP::Promise::IO, HTTP::Promise::Stream, HTTP::Promise::Exception
COPYRIGHT & LICENSE
Copyright(c) 2022 DEGUEST Pte. Ltd.
All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.