Skip to content

Commit 4bb4c9a

Browse files
Grinnzoalders
authored andcommitted
Add 425 Too Early from RFC 8470, and backcompat constants
1 parent 373ea43 commit 4bb4c9a

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

lib/HTTP/Status.pm

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ my %StatusCode = (
6767
422 => 'Unprocessable Entity', # RFC 4918: WebDAV
6868
423 => 'Locked', # RFC 4918: WebDAV
6969
424 => 'Failed Dependency', # RFC 4918: WebDAV
70-
# 425
70+
425 => 'Too Early', # RFC 8470: Using Early Data in HTTP
7171
426 => 'Upgrade Required',
7272
# 427
7373
428 => 'Precondition Required', # RFC 6585: Additional Codes
@@ -95,7 +95,6 @@ my %StatusCode = (
9595
%StatusCode = (
9696
%StatusCode,
9797
418 => 'I\'m a teapot', # RFC 2324: HTCPC/1.0 1-april
98-
425 => 'Unordered Collection', # WebDAV Draft
9998
449 => 'Retry with', # microsoft
10099
509 => 'Bandwidth Limit Exceeded', # Apache / cPanel
101100
);
@@ -127,9 +126,12 @@ push(@EXPORT, "RC_REQUEST_URI_TOO_LARGE");
127126
*RC_REQUEST_RANGE_NOT_SATISFIABLE = \&RC_RANGE_NOT_SATISFIABLE;
128127
push(@EXPORT, "RC_REQUEST_RANGE_NOT_SATISFIABLE");
129128

130-
*RC_NO_CODE = \&RC_UNORDERED_COLLECTION;
129+
*RC_NO_CODE = \&RC_TOO_EARLY;
131130
push(@EXPORT, "RC_NO_CODE");
132131

132+
*RC_UNORDERED_COLLECTION = \&RC_TOO_EARLY;
133+
push(@EXPORT, "RC_UNORDERED_COLLECTION");
134+
133135
*HTTP_REQUEST_ENTITY_TOO_LARGE = \&HTTP_PAYLOAD_TOO_LARGE;
134136
push(@EXPORT_OK, "HTTP_REQUEST_ENTITY_TOO_LARGE");
135137

@@ -139,9 +141,12 @@ push(@EXPORT_OK, "HTTP_REQUEST_URI_TOO_LARGE");
139141
*HTTP_REQUEST_RANGE_NOT_SATISFIABLE = \&HTTP_RANGE_NOT_SATISFIABLE;
140142
push(@EXPORT_OK, "HTTP_REQUEST_RANGE_NOT_SATISFIABLE");
141143

142-
*HTTP_NO_CODE = \&HTTP_UNORDERED_COLLECTION;
144+
*HTTP_NO_CODE = \&HTTP_TOO_EARLY;
143145
push(@EXPORT_OK, "HTTP_NO_CODE");
144146

147+
*HTTP_UNORDERED_COLLECTION = \&HTTP_TOO_EARLY;
148+
push(@EXPORT_OK, "HTTP_UNORDERED_COLLECTION");
149+
145150
our %EXPORT_TAGS = (
146151
constants => [grep /^HTTP_/, @EXPORT_OK],
147152
is => [grep /^is_/, @EXPORT, @EXPORT_OK],
@@ -251,6 +256,7 @@ tag to import them all.
251256
HTTP_UNPROCESSABLE_ENTITY (422)
252257
HTTP_LOCKED (423)
253258
HTTP_FAILED_DEPENDENCY (424)
259+
HTTP_TOO_EARLY (425)
254260
HTTP_UPGRADE_REQUIRED (426)
255261
HTTP_PRECONDITION_REQUIRED (428)
256262
HTTP_TOO_MANY_REQUESTS (429)

t/status.t

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use strict;
22
use warnings;
33

44
use Test::More;
5-
plan tests => 47;
5+
plan tests => 48;
66

77
use HTTP::Status qw(:constants :is status_message);
88

@@ -24,6 +24,7 @@ ok(is_error(HTTP_REQUEST_RANGE_NOT_SATISFIABLE));
2424
ok(is_error(HTTP_RANGE_NOT_SATISFIABLE));
2525
ok(is_error(HTTP_NO_CODE));
2626
ok(is_error(HTTP_UNORDERED_COLLECTION));
27+
ok(is_error(HTTP_TOO_EARLY));
2728

2829
ok(!is_success(HTTP_NOT_FOUND));
2930

0 commit comments

Comments
 (0)