annotate Lib/IMPL/Web/OutOfRangeException.pm @ 379:a471e8b77544

sync
author cin
date Thu, 16 Jan 2014 18:10:50 +0400
parents cca158327c47
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
322
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
1 package IMPL::Web::OutOfRangeException;
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
2 use strict;
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
3
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
4 use IMPL::declare {
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
5 base => {
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
6 'IMPL::Web::Exception' => '@_'
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
7 },
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
8 };
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
9
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
10 sub CTOR {
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
11 my ($this,$range) = @_;
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
12
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
13 #TODO: validate args
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
14
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
15 $this->headers({
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
16 content_range => { $range->{units} . ' */' . $range->{length} }
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
17 });
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
18 }
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
19
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
20 use IMPL::Resources::Strings {
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
21 message => 'The specified range is invalid'
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
22 };
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
23
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
24 sub status {
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
25 "416 Requested Range Not Satisfiable"
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
26 }
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
27
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
28 1;
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
29
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
30 __END__
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
31
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
32 =pod
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
33
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
34 =head1 NAME
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
35
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
36 C<IMPL::Web::OutOfRangeException> A server SHOULD return a response with this
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
37 status code if a request included a Range request-header field (section 14.35),
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
38 and none of the range-specifier values in this field overlap the current extent
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
39 of the selected resource, and the request did not include an If-Range
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
40 request-header field. (For byte-ranges, this means that the first- byte-pos of
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
41 all of the byte-range-spec values were greater than the current length of the
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
42 selected resource.)
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
43
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
44 =head1 DESCRIPTION
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
45
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
46 When this status code is returned for a byte-range request, the response SHOULD
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
47 include a Content-Range entity-header field specifying the current length of the
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
48 selected resource (see section 14.16). This response MUST NOT use the
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
49 multipart/byteranges content- type.
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
50
cca158327c47 added OutOfRangeException
cin
parents:
diff changeset
51 =cut