Coverage Summary

# File Coverage

blib/lib/Prancer/Const.pm
Criterion | Covered | Total | %
--- | --- | --- | ---
statement | 162 | 162 | 100.0
branch |  |  | n/a
condition |  |  | n/a
subroutine | 54 | 54 | 100.0
pod |  |  | n/a
total | 216 | 216 | 100.0

line | stmt | bran | cond | sub | pod | time | code
--- | --- | --- | --- | --- | --- | --- | ---
1 |  |  |  |  |  |  | package Prancer::Const;
2 |  |  |  |  |  |  |
3 | 4 |  |  | 4 |  | 4603 | use strict;
| 4 |  |  |  |  | 6 |
| 4 |  |  |  |  | 122 |
4 | 4 |  |  | 4 |  | 10 | use warnings FATAL => 'all';
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 109 |
5 |  |  |  |  |  |  |
6 | 4 |  |  | 4 |  | 12 | use constant OK => 200;
| 4 |  |  |  |  | 12 |
| 4 |  |  |  |  | 181 |
7 | 4 |  |  | 4 |  | 11 | use constant REDIRECT => 302;
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 126 |
8 | 4 |  |  | 4 |  | 8 | use constant AUTH_REQUIRED => 401;
| 4 |  |  |  |  | 4 |
| 4 |  |  |  |  | 125 |
9 | 4 |  |  | 4 |  | 9 | use constant FORBIDDEN => 403;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 118 |
10 | 4 |  |  | 4 |  | 9 | use constant NOT_FOUND => 404;
| 4 |  |  |  |  | 4 |
| 4 |  |  |  |  | 116 |
11 | 4 |  |  | 4 |  | 11 | use constant SERVER_ERROR => 500;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 142 |
12 |  |  |  |  |  |  |
13 | 4 |  |  | 4 |  | 11 | use constant HTTP_CONTINUE => 100;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 168 |
14 | 4 |  |  | 4 |  | 9 | use constant HTTP_SWITCHING_PROTOCOLS => 101;
| 4 |  |  |  |  | 4 |
| 4 |  |  |  |  | 125 |
15 |  |  |  |  |  |  |
16 | 4 |  |  | 4 |  | 10 | use constant HTTP_OK => 200;
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 113 |
17 | 4 |  |  | 4 |  | 8 | use constant HTTP_CREATED => 201;
| 4 |  |  |  |  | 10 |
| 4 |  |  |  |  | 101 |
18 | 4 |  |  | 4 |  | 18 | use constant HTTP_ACCEPTED => 202;
| 4 |  |  |  |  | 4 |
| 4 |  |  |  |  | 102 |
19 | 4 |  |  | 4 |  | 9 | use constant HTTP_NON_AUTHORITATIVE => 203;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 113 |
20 | 4 |  |  | 4 |  | 8 | use constant HTTP_NO_CONTENT => 204;
| 4 |  |  |  |  | 4 |
| 4 |  |  |  |  | 107 |
21 | 4 |  |  | 4 |  | 9 | use constant HTTP_RESET_CONTENT => 205;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 123 |
22 | 4 |  |  | 4 |  | 8 | use constant HTTP_PARTIAL_CONTENT => 206;
| 4 |  |  |  |  | 10 |
| 4 |  |  |  |  | 108 |
23 |  |  |  |  |  |  |
24 | 4 |  |  | 4 |  | 11 | use constant HTTP_MULTIPLE_CHOICES => 300;
| 4 |  |  |  |  | 1 |
| 4 |  |  |  |  | 112 |
25 | 4 |  |  | 4 |  | 9 | use constant HTTP_MOVED_PERMANENTLY => 301;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 211 |
26 | 4 |  |  | 4 |  | 11 | use constant HTTP_MOVED_TEMPORARILY => 302;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 118 |
27 | 4 |  |  | 4 |  | 11 | use constant HTTP_FOUND => 302;
| 4 |  |  |  |  | 1 |
| 4 |  |  |  |  | 124 |
28 | 4 |  |  | 4 |  | 9 | use constant HTTP_SEE_OTHER => 303;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 115 |
29 | 4 |  |  | 4 |  | 18 | use constant HTTP_NOT_MODIFIED => 304;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 120 |
30 | 4 |  |  | 4 |  | 10 | use constant HTTP_USE_PROXY => 305;
| 4 |  |  |  |  | 0 |
| 4 |  |  |  |  | 112 |
31 | 4 |  |  | 4 |  | 8 | use constant HTTP_TEMPORARY_REDIRECT => 307;
| 4 |  |  |  |  | 4 |
| 4 |  |  |  |  | 117 |
32 | 4 |  |  | 4 |  | 9 | use constant HTTP_PERMAMENT_REDIRECT => 308;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 109 |
33 |  |  |  |  |  |  |
34 | 4 |  |  | 4 |  | 8 | use constant HTTP_BAD_REQUEST => 400;
| 4 |  |  |  |  | 4 |
| 4 |  |  |  |  | 114 |
35 | 4 |  |  | 4 |  | 9 | use constant HTTP_UNAUTHORIZED => 401;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 120 |
36 | 4 |  |  | 4 |  | 8 | use constant HTTP_PAYMENT_REQUIRED => 402;
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 150 |
37 | 4 |  |  | 4 |  | 9 | use constant HTTP_FORBIDDEN => 403;
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 112 |
38 | 4 |  |  | 4 |  | 13 | use constant HTTP_NOT_FOUND => 404;
| 4 |  |  |  |  | 0 |
| 4 |  |  |  |  | 102 |
39 | 4 |  |  | 4 |  | 8 | use constant HTTP_METHOD_NOT_ALLOWED => 405;
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 116 |
40 | 4 |  |  | 4 |  | 9 | use constant HTTP_NOT_ACCEPTABLE => 406;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 124 |
41 | 4 |  |  | 4 |  | 9 | use constant HTTP_PROXY_AUTHENTICATION_REQUIRED => 407;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 109 |
42 | 4 |  |  | 4 |  | 8 | use constant HTTP_REQUEST_TIME_OUT => 408;
| 4 |  |  |  |  | 4 |
| 4 |  |  |  |  | 136 |
43 | 4 |  |  | 4 |  | 9 | use constant HTTP_CONFLICT => 409;
| 4 |  |  |  |  | 4 |
| 4 |  |  |  |  | 116 |
44 | 4 |  |  | 4 |  | 8 | use constant HTTP_GONE => 410;
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 118 |
45 | 4 |  |  | 4 |  | 9 | use constant HTTP_LENGTH_REQUIRED => 411;
| 4 |  |  |  |  | 1 |
| 4 |  |  |  |  | 106 |
46 | 4 |  |  | 4 |  | 9 | use constant HTTP_PRECONDITION_FAILED => 412;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 106 |
47 | 4 |  |  | 4 |  | 8 | use constant HTTP_REQUEST_ENTITY_TOO_LARGE => 413;
| 4 |  |  |  |  | 11 |
| 4 |  |  |  |  | 112 |
48 | 4 |  |  | 4 |  | 9 | use constant HTTP_REQUEST_URI_TOO_LARGE => 414;
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 130 |
49 | 4 |  |  | 4 |  | 10 | use constant HTTP_UNSUPPORTED_MEDIA_TYPE => 415;
| 4 |  |  |  |  | 7 |
| 4 |  |  |  |  | 126 |
50 | 4 |  |  | 4 |  | 10 | use constant HTTP_RANGE_NOT_SATISFIABLE => 416;
| 4 |  |  |  |  | 1 |
| 4 |  |  |  |  | 106 |
51 | 4 |  |  | 4 |  | 14 | use constant HTTP_EXPECTATION_FAILED => 417;
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 108 |
52 | 4 |  |  | 4 |  | 8 | use constant HTTP_UPGRADE_REQUIRED => 426; # RFC 2817
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 112 |
53 | 4 |  |  | 4 |  | 8 | use constant HTTP_PRECONDITION_REQUIRED => 428;
| 4 |  |  |  |  | 1 |
| 4 |  |  |  |  | 108 |
54 | 4 |  |  | 4 |  | 8 | use constant HTTP_TOO_MANY_REQUESTS => 429; # RFC 6585
| 4 |  |  |  |  | 1 |
| 4 |  |  |  |  | 111 |
55 | 4 |  |  | 4 |  | 9 | use constant HTTP_REQUEST_HEADER_TOO_LARGE => 431; # RFC 6585
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 123 |
56 |  |  |  |  |  |  |
57 | 4 |  |  | 4 |  | 11 | use constant HTTP_INTERNAL_SERVER_ERROR => 500;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 101 |
58 | 4 |  |  | 4 |  | 12 | use constant HTTP_NOT_IMPLEMENTED => 501;
| 4 |  |  |  |  | 1 |
| 4 |  |  |  |  | 117 |
59 | 4 |  |  | 4 |  | 9 | use constant HTTP_BAD_GATEWAY => 502;
| 4 |  |  |  |  | 2 |
| 4 |  |  |  |  | 106 |
60 | 4 |  |  | 4 |  | 8 | use constant HTTP_SERVICE_UNAVAILABLE => 503;
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 99 |
61 | 4 |  |  | 4 |  | 17 | use constant HTTP_GATEWAY_TIME_OUT => 504;
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 139 |
62 | 4 |  |  | 4 |  | 10 | use constant HTTP_VERSION_NOT_SUPPORTED => 505;
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 280 |
63 |  |  |  |  |  |  |
64 |  |  |  |  |  |  | 1;
65 |  |  |  |  |  |  |
66 |  |  |  |  |  |  | =head1 NAME
67 |  |  |  |  |  |  |
68 |  |  |  |  |  |  | Prancer::Const
69 |  |  |  |  |  |  |
70 |  |  |  |  |  |  | =head1 SYNOPSIS
71 |  |  |  |  |  |  |
72 |  |  |  |  |  |  | use Prancer::Const;
73 |  |  |  |  |  |  |
74 |  |  |  |  |  |  | sub handle {
75 |  |  |  |  |  |  | my $self = shift;
76 |  |  |  |  |  |  |
77 |  |  |  |  |  |  | mount('GET', '/', sub {
78 |  |  |  |  |  |  |
79 |  |  |  |  |  |  | ...
80 |  |  |  |  |  |  |
81 |  |  |  |  |  |  | context->finalize(Prancer::Const::OK);
82 |  |  |  |  |  |  | });
83 |  |  |  |  |  |  |
84 |  |  |  |  |  |  | dispatch;
85 |  |  |  |  |  |  | }
86 |  |  |  |  |  |  |
87 |  |  |  |  |  |  | =head1 COMMONLY USED ATTRIBUTES
88 |  |  |  |  |  |  |
89 |  |  |  |  |  |  | =over 4
90 |  |  |  |  |  |  |
91 |  |  |  |  |  |  | =item Prancer::Const::OK
92 |  |  |  |  |  |  |
93 |  |  |  |  |  |  | Alias for C<Prancer::Const::HTTP_OK>.
94 |  |  |  |  |  |  |
95 |  |  |  |  |  |  | =item Prancer::Const::REDIRECT
96 |  |  |  |  |  |  |
97 |  |  |  |  |  |  | Alias for C<Prancer::Const::HTTP_MOVED_TEMPORARILY>.
98 |  |  |  |  |  |  |
99 |  |  |  |  |  |  | =item Prancer::Const::AUTH_REQUIRED
100 |  |  |  |  |  |  |
101 |  |  |  |  |  |  | Alias for C<Prancer::Const::HTTP_UNAUTHORIZED>.
102 |  |  |  |  |  |  |
103 |  |  |  |  |  |  | =item Prancer::Const::FORBIDDEN
104 |  |  |  |  |  |  |
105 |  |  |  |  |  |  | Alias for C<Prancer::Const::HTTP_FORBIDDEN>.
106 |  |  |  |  |  |  |
107 |  |  |  |  |  |  | =item Prancer::Const::NOT_FOUND
108 |  |  |  |  |  |  |
109 |  |  |  |  |  |  | Alias for C<Prancer::Const::HTTP_NOT_FOUND>.
110 |  |  |  |  |  |  |
111 |  |  |  |  |  |  | =item Prancer::Const::SERVER_ERROR
112 |  |  |  |  |  |  |
113 |  |  |  |  |  |  | Alias for C<Prancer::Const::HTTP_INTERNAL_SERVER_ERROR>.
114 |  |  |  |  |  |  |
115 |  |  |  |  |  |  | =back
116 |  |  |  |  |  |  |
117 |  |  |  |  |  |  | =head1 1xx INFORMATIONAL
118 |  |  |  |  |  |  |
119 |  |  |  |  |  |  | =over 4
120 |  |  |  |  |  |  |
121 |  |  |  |  |  |  | =item Prancer::Const::HTTP_CONTINUE (100)
122 |  |  |  |  |  |  |
123 |  |  |  |  |  |  | This means that the server has received the request headers, and that the
124 |  |  |  |  |  |  | client should proceed to send the request body (in the case of a request for
125 |  |  |  |  |  |  | which a body needs to be sent; for example, a POST request). If the request
126 |  |  |  |  |  |  | body is large, sending it to a server when a request has already been rejected
127 |  |  |  |  |  |  | based upon inappropriate headers is inefficient. To have a server check if the
128 |  |  |  |  |  |  | request could be accepted based on the request's headers alone, a client must
129 |  |  |  |  |  |  | send C<Expect: 100-continue> as a header in its initial request and check if a
130 |  |  |  |  |  |  | C<100 Continue> status code is received in response before continuing (or
131 |  |  |  |  |  |  | receive C<417 Expectation Failed> and not continue).
132 |  |  |  |  |  |  |
133 |  |  |  |  |  |  | =item Prancer::Const::HTTP_SWITCHING_PROTOCOLS (101)
134 |  |  |  |  |  |  |
135 |  |  |  |  |  |  | This means the requester has asked the server to switch protocols and the
136 |  |  |  |  |  |  | server is acknowledging that it will do so.
137 |  |  |  |  |  |  |
138 |  |  |  |  |  |  | =back
139 |  |  |  |  |  |  |
140 |  |  |  |  |  |  | =head1 2xx SUCCESS
141 |  |  |  |  |  |  |
142 |  |  |  |  |  |  | =over 4
143 |  |  |  |  |  |  |
144 |  |  |  |  |  |  | =item Prancer::Const::HTTP_OK (200)
145 |  |  |  |  |  |  |
146 |  |  |  |  |  |  | Standard response for successful HTTP requests. The actual response will depend
147 |  |  |  |  |  |  | on the request method used. In a GET request, the response will contain an
148 |  |  |  |  |  |  | entity corresponding to the requested resource. In a POST request the response
149 |  |  |  |  |  |  | will contain an entity describing or containing the result of the action.
150 |  |  |  |  |  |  |
151 |  |  |  |  |  |  | =item Prancer::Const::HTTP_CREATED (201)
152 |  |  |  |  |  |  |
153 |  |  |  |  |  |  | The request has been fulfilled and resulted in a new resource being created.
154 |  |  |  |  |  |  |
155 |  |  |  |  |  |  | =item Prancer::Const::HTTP_ACCEPTED (202)
156 |  |  |  |  |  |  |
157 |  |  |  |  |  |  | The request has been accepted for processing, but the processing has not been
158 |  |  |  |  |  |  | completed. The request might or might not eventually be acted upon, as it might
159 |  |  |  |  |  |  | be disallowed when processing actually takes place.
160 |  |  |  |  |  |  |
161 |  |  |  |  |  |  | =item Prancer::Const::HTTP_NON_AUTHORITATIVE (203)
162 |  |  |  |  |  |  |
163 |  |  |  |  |  |  | The server successfully processed the request, but is returning information
164 |  |  |  |  |  |  | that may be from another source.
165 |  |  |  |  |  |  |
166 |  |  |  |  |  |  | =item Prancer::Const::HTTP_NO_CONTENT (204)
167 |  |  |  |  |  |  |
168 |  |  |  |  |  |  | The server successfully processed the request, but is not returning any
169 |  |  |  |  |  |  | content. Usually used as a response to a successful delete request.
170 |  |  |  |  |  |  |
171 |  |  |  |  |  |  | =item Prancer::Const::HTTP_RESET_CONTENT (205)
172 |  |  |  |  |  |  |
173 |  |  |  |  |  |  | The server successfully processed the request, but is not returning any
174 |  |  |  |  |  |  | content. Unlike a 204 response, this response requires that the requester reset
175 |  |  |  |  |  |  | the document view.
176 |  |  |  |  |  |  |
177 |  |  |  |  |  |  | =item Prancer::Const::HTTP_PARTIAL_CONTENT (206)
178 |  |  |  |  |  |  |
179 |  |  |  |  |  |  | The server is delivering only part of the resource due to a range header sent
180 |  |  |  |  |  |  | by the client. The range header is used by tools like wget to enable resuming
181 |  |  |  |  |  |  | of interrupted downloads, or split a download into multiple simultaneous
182 |  |  |  |  |  |  | streams.
183 |  |  |  |  |  |  |
184 |  |  |  |  |  |  | =back
185 |  |  |  |  |  |  |
186 |  |  |  |  |  |  | =head1 3xx REDIRECTION
187 |  |  |  |  |  |  |
188 |  |  |  |  |  |  | =over 4
189 |  |  |  |  |  |  |
190 |  |  |  |  |  |  | =item Prancer::Const::HTTP_MULTIPLE_CHOICES (300)
191 |  |  |  |  |  |  |
192 |  |  |  |  |  |  | Indicates multiple options for the resource that the client may follow. It, for
193 |  |  |  |  |  |  | instance, could be used to present different format options for video, list
194 |  |  |  |  |  |  | files with different extensions, or word sense disambiguation.
195 |  |  |  |  |  |  |
196 |  |  |  |  |  |  | =item Prancer::Const::HTTP_MOVED_PERMANENTLY (301)
197 |  |  |  |  |  |  |
198 |  |  |  |  |  |  | This and all future requests should be directed to the given URI.
199 |  |  |  |  |  |  |
200 |  |  |  |  |  |  | =item Prancer::Const::HTTP_MOVED_TEMPORARILY (302)
201 |  |  |  |  |  |  |
202 |  |  |  |  |  |  | This is an example of industry practice contradicting the standard. The
203 |  |  |  |  |  |  | HTTP/1.0 specification (RFC 1945) required the client to perform a temporary
204 |  |  |  |  |  |  | redirect (the original describing phrase was "Moved Temporarily"), but popular
205 |  |  |  |  |  |  | browsers implemented 302 with the functionality of a 303 See Other. Therefore,
206 |  |  |  |  |  |  | HTTP/1.1 added status codes 303 and 307 to distinguish between the two
207 |  |  |  |  |  |  | behaviors. However, some Web applications and frameworks use the 302 status
208 |  |  |  |  |  |  | code as if it were the 303.
209 |  |  |  |  |  |  |
210 |  |  |  |  |  |  | =item Prancer::Const::HTTP_FOUND (302)
211 |  |  |  |  |  |  |
212 |  |  |  |  |  |  | This is the same as C<Prancer::Const::HTTP_MOVED_TEMPORARILIY>.
213 |  |  |  |  |  |  |
214 |  |  |  |  |  |  | =item Prancer::Const::HTTP_SEE_OTHER (303)
215 |  |  |  |  |  |  |
216 |  |  |  |  |  |  | The response to the request can be found under another URI using a GET method.
217 |  |  |  |  |  |  | When received in response to a POST (or PUT/DELETE), it should be assumed that
218 |  |  |  |  |  |  | the server has received the data and the redirect should be issued with a
219 |  |  |  |  |  |  | separate GET message
220 |  |  |  |  |  |  |
221 |  |  |  |  |  |  | =item Prancer::Const::HTTP_NOT_MODIFIED (304)
222 |  |  |  |  |  |  |
223 |  |  |  |  |  |  | Indicates that the resource has not been modified since the version specified
224 |  |  |  |  |  |  | by the request headers If-Modified-Since or If-Match. This means that there is
225 |  |  |  |  |  |  | no need to retransmit the resource, since the client still has a previously
226 |  |  |  |  |  |  | downloaded copy.
227 |  |  |  |  |  |  |
228 |  |  |  |  |  |  | =item Prancer::Const::HTTP_USE_PROXY (305)
229 |  |  |  |  |  |  |
230 |  |  |  |  |  |  | The requested resource is only available through a proxy, whose address is
231 |  |  |  |  |  |  | provided in the response. Many HTTP clients (such as Mozilla and Internet
232 |  |  |  |  |  |  | Explorer) do not correctly handle responses with this status code, primarily
233 |  |  |  |  |  |  | for security reasons.
234 |  |  |  |  |  |  |
235 |  |  |  |  |  |  | =item Prancer::Const::HTTP_TEMPORARY_REDIRECT (307)
236 |  |  |  |  |  |  |
237 |  |  |  |  |  |  | In this case, the request should be repeated with another URI; however, future
238 |  |  |  |  |  |  | requests should still use the original URI. In contrast to how 302 was
239 |  |  |  |  |  |  | historically implemented, the request method is not allowed to be changed when
240 |  |  |  |  |  |  | reissuing the original request. For instance, a POST request should be repeated
241 |  |  |  |  |  |  | using another POST request.
242 |  |  |  |  |  |  |
243 |  |  |  |  |  |  | =item Prancer::Const::HTTP_PERMAMENT_REDIRECT (308)
244 |  |  |  |  |  |  |
245 |  |  |  |  |  |  | The request, and all future requests should be repeated using another URI. 307
246 |  |  |  |  |  |  | and 308 (as proposed) parallel the behaviors of 302 and 301, but do not allow
247 |  |  |  |  |  |  | the HTTP method to change. So, for example, submitting a form to a permanently
248 |  |  |  |  |  |  | redirected resource may continue smoothly.
249 |  |  |  |  |  |  |
250 |  |  |  |  |  |  | =back
251 |  |  |  |  |  |  |
252 |  |  |  |  |  |  | =head1 4xx CLIENT ERROR
253 |  |  |  |  |  |  |
254 |  |  |  |  |  |  | =over 4
255 |  |  |  |  |  |  |
256 |  |  |  |  |  |  | =item Prancer::Const::HTTP_BAD_REQUEST (400)
257 |  |  |  |  |  |  |
258 |  |  |  |  |  |  | The request cannot be fulfilled due to bad syntax.
259 |  |  |  |  |  |  |
260 |  |  |  |  |  |  | =item Prancer::Const::HTTP_UNAUTHORIZED (401)
261 |  |  |  |  |  |  |
262 |  |  |  |  |  |  | Similar to C<403 Forbidden>, but specifically for use when authentication is
263 |  |  |  |  |  |  | required and has failed or has not yet been provided. The response must include
264 |  |  |  |  |  |  | a C<WWW-Authenticate> header field containing a challenge applicable to the
265 |  |  |  |  |  |  | requested resource. See Basic access authentication and Digest access
266 |  |  |  |  |  |  | authentication.
267 |  |  |  |  |  |  |
268 |  |  |  |  |  |  | =item Prancer::Const::HTTP_PAYMENT_REQUIRED (402)
269 |  |  |  |  |  |  |
270 |  |  |  |  |  |  | Reserved for future use. The original intention was that this code might be
271 |  |  |  |  |  |  | used as part of some form of digital cash or micropayment scheme, but that has
272 |  |  |  |  |  |  | not happened, and this code is not usually used. YouTube uses this status if a
273 |  |  |  |  |  |  | particular IP address has made excessive requests, and requires the person to
274 |  |  |  |  |  |  | enter a CAPTCHA.
275 |  |  |  |  |  |  |
276 |  |  |  |  |  |  | =item Prancer::Const::HTTP_FORBIDDEN (403)
277 |  |  |  |  |  |  |
278 |  |  |  |  |  |  | The request was a valid request, but the server is refusing to respond to it.
279 |  |  |  |  |  |  | Unlike a C<401 Unauthorized> response, authenticating will make no difference.
280 |  |  |  |  |  |  | On servers where authentication is required, this commonly means that the
281 |  |  |  |  |  |  | provided credentials were successfully authenticated but that the credentials
282 |  |  |  |  |  |  | still do not grant the client permission to access the resource (e.g., a
283 |  |  |  |  |  |  | recognized user attempting to access restricted content).
284 |  |  |  |  |  |  |
285 |  |  |  |  |  |  | =item Prancer::Const::HTTP_NOT_FOUND (404)
286 |  |  |  |  |  |  |
287 |  |  |  |  |  |  | The requested resource could not be found but may be available again in the
288 |  |  |  |  |  |  | future. Subsequent requests by the client are permissible.
289 |  |  |  |  |  |  |
290 |  |  |  |  |  |  | =item Prancer::Const::HTTP_METHOD_NOT_ALLOWED (405)
291 |  |  |  |  |  |  |
292 |  |  |  |  |  |  | A request was made of a resource using a request method not supported by that
293 |  |  |  |  |  |  | resource; for example, using GET on a form which requires data to be presented
294 |  |  |  |  |  |  | via POST, or using PUT on a read-only resource.
295 |  |  |  |  |  |  |
296 |  |  |  |  |  |  | =item Prancer::Const::HTTP_NOT_ACCEPTABLE (406)
297 |  |  |  |  |  |  |
298 |  |  |  |  |  |  | The requested resource is only capable of generating content not acceptable
299 |  |  |  |  |  |  | according to the C<Accept> headers sent in the request.
300 |  |  |  |  |  |  |
301 |  |  |  |  |  |  | =item Prancer::Const::HTTP_PROXY_AUTHENTICATION_REQUIRED (407)
302 |  |  |  |  |  |  |
303 |  |  |  |  |  |  | The client must first authenticate itself with the proxy.
304 |  |  |  |  |  |  |
305 |  |  |  |  |  |  | =item Prancer::Const::HTTP_REQUEST_TIME_OUT (408)
306 |  |  |  |  |  |  |
307 |  |  |  |  |  |  | The server timed out waiting for the request. According to W3 HTTP
308 |  |  |  |  |  |  | specifications: "The client did not produce a request within the time that the
309 |  |  |  |  |  |  | server was prepared to wait. The client MAY repeat the request without
310 |  |  |  |  |  |  | modifications at any later time."
311 |  |  |  |  |  |  |
312 |  |  |  |  |  |  | =item Prancer::Const::HTTP_CONFLICT (409)
313 |  |  |  |  |  |  |
314 |  |  |  |  |  |  | Indicates that the request could not be processed because of conflict in the
315 |  |  |  |  |  |  | request, such as an edit conflict in the case of multiple updates.
316 |  |  |  |  |  |  |
317 |  |  |  |  |  |  | =item Prancer::Const::HTTP_GONE (410)
318 |  |  |  |  |  |  |
319 |  |  |  |  |  |  | Indicates that the resource requested is no longer available and will not be
320 |  |  |  |  |  |  | available again. This should be used when a resource has been intentionally
321 |  |  |  |  |  |  | removed and the resource should be purged. Upon receiving a 410 status code,
322 |  |  |  |  |  |  | the client should not request the resource again in the future. Clients such as
323 |  |  |  |  |  |  | search engines should remove the resource from their indices. Most use cases do
324 |  |  |  |  |  |  | not require clients and search engines to purge the resource, and a "404 Not
325 |  |  |  |  |  |  | Found" may be used instead.
326 |  |  |  |  |  |  |
327 |  |  |  |  |  |  | =item Prancer::Const::HTTP_LENGTH_REQUIRED (411)
328 |  |  |  |  |  |  |
329 |  |  |  |  |  |  | The request did not specify the length of its content, which is required by the
330 |  |  |  |  |  |  | requested resource.
331 |  |  |  |  |  |  |
332 |  |  |  |  |  |  | =item Prancer::Const::HTTP_PRECONDITION_FAILED (412)
333 |  |  |  |  |  |  |
334 |  |  |  |  |  |  | The server does not meet one of the preconditions that the requester put on the
335 |  |  |  |  |  |  | request.
336 |  |  |  |  |  |  |
337 |  |  |  |  |  |  | =item Prancer::Const::HTTP_REQUEST_ENTITY_TOO_LARGE (413)
338 |  |  |  |  |  |  |
339 |  |  |  |  |  |  | The request is larger than the server is willing or able to process.
340 |  |  |  |  |  |  |
341 |  |  |  |  |  |  | =item Prancer::Const::HTTP_REQUEST_URI_TOO_LARGE (414)
342 |  |  |  |  |  |  |
343 |  |  |  |  |  |  | The URI provided was too long for the server to process. Often the result of
344 |  |  |  |  |  |  | too much data being encoded as a query-string of a GET request, in which case
345 |  |  |  |  |  |  | it should be converted to a POST request.
346 |  |  |  |  |  |  |
347 |  |  |  |  |  |  | =item Prancer::Const::HTTP_UNSUPPORTED_MEDIA_TYPE (415)
348 |  |  |  |  |  |  |
349 |  |  |  |  |  |  | The request entity has a media type which the server or resource does not
350 |  |  |  |  |  |  | support. For example, the client uploads an image as C<image/svg+xml>, but the
351 |  |  |  |  |  |  | server requires that images use a different format.
352 |  |  |  |  |  |  |
353 |  |  |  |  |  |  | =item Prancer::Const::HTTP_RANGE_NOT_SATISFIABLE (416)
354 |  |  |  |  |  |  |
355 |  |  |  |  |  |  | The client has asked for a portion of the file, but the server cannot supply
356 |  |  |  |  |  |  | that portion. For example, if the client asked for a part of the file that lies
357 |  |  |  |  |  |  | beyond the end of the file.
358 |  |  |  |  |  |  |
359 |  |  |  |  |  |  | =item Prancer::Const::HTTP_EXPECTATION_FAILED (417)
360 |  |  |  |  |  |  |
361 |  |  |  |  |  |  | The server cannot meet the requirements of the Expect request-header field.
362 |  |  |  |  |  |  |
363 |  |  |  |  |  |  | =item Prancer::Const::HTTP_UPGRADE_REQUIRED (426)
364 |  |  |  |  |  |  |
365 |  |  |  |  |  |  | The client should switch to a different protocol such as TLS/1.0.
366 |  |  |  |  |  |  |
367 |  |  |  |  |  |  | =item Prancer::Const::HTTP_PRECONDITION_REQUIRED (428)
368 |  |  |  |  |  |  |
369 |  |  |  |  |  |  | The origin server requires the request to be conditional. Intended to prevent
370 |  |  |  |  |  |  | "the 'lost update' problem, where a client GETs a resource's state, modifies
371 |  |  |  |  |  |  | it, and PUTs it back to the server, when meanwhile a third party has modified
372 |  |  |  |  |  |  | the state on the server, leading to a conflict."
373 |  |  |  |  |  |  |
374 |  |  |  |  |  |  | =item Prancer::Const::HTTP_TOO_MANY_REQUESTS (429)
375 |  |  |  |  |  |  |
376 |  |  |  |  |  |  | The user has sent too many requests in a given amount of time. Intended for use
377 |  |  |  |  |  |  | with rate limiting schemes.
378 |  |  |  |  |  |  |
379 |  |  |  |  |  |  | =item Prancer::Const::HTTP_REQUEST_HEADER_TOO_LARGE (431)
380 |  |  |  |  |  |  |
381 |  |  |  |  |  |  | The server is unwilling to process the request because either an individual
382 |  |  |  |  |  |  | header field, or all the header fields collectively, are too large.
383 |  |  |  |  |  |  |
384 |  |  |  |  |  |  | =back
385 |  |  |  |  |  |  |
386 |  |  |  |  |  |  | =head1 5xx SERVER ERROR
387 |  |  |  |  |  |  |
388 |  |  |  |  |  |  | =over 4
389 |  |  |  |  |  |  |
390 |  |  |  |  |  |  | =item Prancer::Const::HTTP_INTERNAL_SERVER_ERROR (500)
391 |  |  |  |  |  |  |
392 |  |  |  |  |  |  | A generic error message, given when no more specific message is suitable.
393 |  |  |  |  |  |  |
394 |  |  |  |  |  |  | =item Prancer::Const::HTTP_NOT_IMPLEMENTED (501)
395 |  |  |  |  |  |  |
396 |  |  |  |  |  |  | The server either does not recognize the request method, or it lacks the
397 |  |  |  |  |  |  | ability to fulfill the request. Usually this implies future availability (e.g.,
398 |  |  |  |  |  |  | a new feature of a web-service API).
399 |  |  |  |  |  |  |
400 |  |  |  |  |  |  | =item Prancer::Const::HTTP_BAD_GATEWAY (502)
401 |  |  |  |  |  |  |
402 |  |  |  |  |  |  | The server was acting as a gateway or proxy and received an invalid response
403 |  |  |  |  |  |  | from the upstream server.
404 |  |  |  |  |  |  |
405 |  |  |  |  |  |  | =item Prancer::Const::HTTP_SERVICE_UNAVAILABLE (503)
406 |  |  |  |  |  |  |
407 |  |  |  |  |  |  | The server is currently unavailable (because it is overloaded or down for
408 |  |  |  |  |  |  | maintenance). Generally, this is a temporary state. Sometimes, this can be
409 |  |  |  |  |  |  | permanent as well on test servers.
410 |  |  |  |  |  |  |
411 |  |  |  |  |  |  | =item Prancer::Const::HTTP_GATEWAY_TIME_OUT (504)
412 |  |  |  |  |  |  |
413 |  |  |  |  |  |  | The server was acting as a gateway or proxy and did not receive a timely
414 |  |  |  |  |  |  | response from the upstream server.
415 |  |  |  |  |  |  |
416 |  |  |  |  |  |  | =item Prancer::Const::HTTP_VERSION_NOT_SUPPORTED (505)
417 |  |  |  |  |  |  |
418 |  |  |  |  |  |  | The server does not support the HTTP protocol version used in the request.
419 |  |  |  |  |  |  |
420 |  |  |  |  |  |  | =back
421 |  |  |  |  |  |  |
422 |  |  |  |  |  |  | =head1 CREDITS
423 |  |  |  |  |  |  |
424 |  |  |  |  |  |  | This documentation was copied almost entirely from L<Wikipedia's documentation
425 |  |  |  |  |  |  | on HTTP codes|http://en.wikipedia.org/wiki/Http_codes> and is freely available
426 |  |  |  |  |  |  | under L<Creative Commons Attribution-ShareAlike License|http://creativecommons.org/licenses/by-sa/3.0/>.
427 |  |  |  |  |  |  |
428 |  |  |  |  |  |  | =cut
429 |  |  |  |  |  |  |