| 1 | package HTTP::Throwable::Role::Status::RequestedRangeNotSatisfiable 0.028; | ||
| 2 | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 3 | |||
| 4 | use Types::Standard qw(Str); | ||
| 5 | |||
| 6 | use Moo::Role; | ||
| 7 | |||
| 8 | with( | ||
| 9 | 'HTTP::Throwable', | ||
| 10 | 'HTTP::Throwable::Role::BoringText', | ||
| 11 | ); | ||
| 12 | |||
| 13 | sub default_status_code { 416 } | ||
| 14 | sub default_reason { 'Requested Range Not Satisfiable' } | ||
| 15 | |||
| 16 | has 'content_range' => ( is => 'ro', isa => Str ); | ||
| 17 | |||
| 18 | around 'build_headers' => sub { | ||
| 19 | my $next = shift; | ||
| 20 | my $self = shift; | ||
| 21 | my $headers = $self->$next( @_ ); | ||
| 22 | if ( my $content_range = $self->content_range ) { | ||
| 23 | push @$headers => ('Content-Range' => $content_range); | ||
| 24 | } | ||
| 25 | $headers; | ||
| 26 | }; | ||
| 27 | |||
| 28 | no Moo::Role; 1; | ||
| 29 | |||
| 30 | =pod | ||
| 31 | |||
| 32 | =encoding UTF-8 | ||
| 33 | |||
| 34 | =head1 NAME | ||
| 35 | |||
| 36 | HTTP::Throwable::Role::Status::RequestedRangeNotSatisfiable - 416 Requested Range Not Satisfiable | ||
| 37 | |||
| 38 | =head1 VERSION | ||
| 39 | |||
| 40 | version 0.028 | ||
| 41 | |||
| 42 | =head1 DESCRIPTION | ||
| 43 | |||
| 44 | A server SHOULD return a response with this status code if a | ||
| 45 | request included a Range request-header field, and none of the | ||
| 46 | range-specifier values in this field overlap the current extent | ||
| 47 | of the selected resource, and the request did not include an | ||
| 48 | If-Range request-header field. (For byte-ranges, this means that | ||
| 49 | the first-byte-pos of all of the byte-range-spec values were greater | ||
| 50 | than the current length of the selected resource.) | ||
| 51 | |||
| 52 | When this status code is returned for a byte-range request, the | ||
| 53 | response SHOULD include a Content-Range entity-header field specifying | ||
| 54 | the current length of the selected resource. This response MUST NOT | ||
| 55 | use the multipart/byteranges content-type. | ||
| 56 | |||
| 57 | =head1 PERL VERSION | ||
| 58 | |||
| 59 | This library should run on perls released even a long time ago. It should work | ||
| 60 | on any version of perl released in the last five years. | ||
| 61 | |||
| 62 | Although it may work on older versions of perl, no guarantee is made that the | ||
| 63 | minimum required version will not be increased. The version may be increased | ||
| 64 | for any reason, and there is no promise that patches will be accepted to lower | ||
| 65 | the minimum required perl. | ||
| 66 | |||
| 67 | =head1 AUTHORS | ||
| 68 | |||
| 69 | =over 4 | ||
| 70 | |||
| 71 | =item * | ||
| 72 | |||
| 73 | Stevan Little <stevan.little@iinteractive.com> | ||
| 74 | |||
| 75 | =item * | ||
| 76 | |||
| 77 | Ricardo Signes <cpan@semiotic.systems> | ||
| 78 | |||
| 79 | =back | ||
| 80 | |||
| 81 | =head1 COPYRIGHT AND LICENSE | ||
| 82 | |||
| 83 | This software is copyright (c) 2011 by Infinity Interactive, Inc. | ||
| 84 | |||
| 85 | This is free software; you can redistribute it and/or modify it under | ||
| 86 | the same terms as the Perl 5 programming language system itself. | ||
| 87 | |||
| 88 | =cut | ||
| 89 | |||
| 90 | __END__ |