HTTP::Promise::Headers::ContentRange - Content-Range Header Field
use HTTP::Promise::Headers::ContentRange; my $range = HTTP::Promise::Headers::ContentRange->new || die( HTTP::Promise::Headers::ContentRange->error, "\n" ); $range->unit( 'bytes' ): $range->range_start(500); $range->range_end(1000); $range->size(2048); say $range->as_string; # or say "$range"; # 416 Range Not Satisfiable # <https://tools.ietf.org/html/rfc7233#section-4.4> $range->start_end( undef ); $range->size(2048); say "$range"; # bytes */2048
v0.1.0
The following description is taken from Mozilla documentation.
Content-Range: bytes 200-1000/67589 # When the complete range is unknown: Content-Range: bytes 42-1233/* # The first 500 bytes: Content-Range: bytes 0-499/1234 # The second 500 bytes: Content-Range: bytes 500-999/1234 # All except for the first 500 bytes: Content-Range: bytes 500-1233/1234 # The last 500 bytes: Content-Range: bytes 734-1233/1234 # Unsatisfiable range value Content-Range: bytes */1234
Returns a string representation of the object.
If both range-start and range-end properties are undef, they will be replaced by a * (wildcard)
range-start
range-end
undef
*
If size property is undef it will be replaced by a * (wildcard)
size
An integer in the given unit indicating the end position (zero-indexed & inclusive) of the requested range.
An integer in the given unit indicating the start position (zero-indexed & inclusive) of the request range.
The total length of the document (or '*' if unknown).
This is a convenience method to set both the range-start and range-end property.
The unit in which ranges are specified. This is usually bytes.
bytes
Jacques Deguest <jack@deguest.jp>
Accept-Range, If-Range, Range
Accept-Range
If-Range
Range
See rfc7233, section 4.2 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(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.
To install HTTP::Promise, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::Promise
CPAN shell
perl -MCPAN -e shell install HTTP::Promise
For more information on module installation, please visit the detailed CPAN module installation guide.