...
 
Commits (4)
# HOW TO CONTRIBUTE
Thank you for considering contributing to this distribution. This file
contains instructions that will help you work with the source code.
The distribution is managed with [Dist::Zilla](https://metacpan.org/pod/Dist::Zilla).
This means that many of the usual files you might expect are not in the
repository, but are generated at release time. Some generated files are kept
in the repository as a convenience (e.g. Build.PL/Makefile.PL and META.json).
Generally, **you do not need Dist::Zilla to contribute patches**. You may need
Dist::Zilla to create a tarball. See below for guidance.
## Getting dependencies
If you have App::cpanminus 1.6 or later installed, you can use
[cpanm](https://metacpan.org/pod/cpanm) to satisfy dependencies like this:
$ cpanm --installdeps --with-develop .
You can also run this command (or any other cpanm command) without installing
App::cpanminus first, using the fatpacked `cpanm` script via curl or wget:
$ curl -L https://cpanmin.us | perl - --installdeps --with-develop .
$ wget -qO - https://cpanmin.us | perl - --installdeps --with-develop .
Otherwise, look for either a `cpanfile` or `META.json` file for a list of
dependencies to satisfy.
## Running tests
You can run tests directly using the `prove` tool:
$ prove -l
$ prove -lv t/some_test_file.t
## Code style and tidying
This distribution contains a `.perltidyrc` file in the root of the repository.
Please install Perl::Tidy and use `perltidy` before submitting patches. However,
as this is an old distribution and styling has changed somewhat over the years,
please keep your tidying constrained to the portion of code or function in which
you're patching.
$ perltidy lib/HTTP/Status.pm -o my_tidy_copy.pm
The above command, for example, would provide you with a copy of `Status.pm`
that has been cleaned according to our `.perltidyrc` settings. You'd then look
at the newly created `my_tidy_copy.pm` in the dist root and replace your work
with the cleaned up copy if there are differences.
This may seem like an arbitrary thing, but it is immensely helpful if all code
is written in a singular style. If everything were tidy, it'd look like one
single person wrote the code rather than a mish-mash.
## Installing and using Dist::Zilla
[Dist::Zilla](https://metacpan.org/pod/Dist::Zilla) is a very powerful
authoring tool, optimized for maintaining a large number of distributions with
a high degree of automation, but it has a large dependency chain, a bit of a
learning curve and requires a number of author-specific plugins.
To install it from CPAN, I recommend one of the following approaches for the
quickest installation:
# using CPAN.pm, but bypassing non-functional pod tests
$ cpan TAP::Harness::Restricted
$ PERL_MM_USE_DEFAULT=1 HARNESS_CLASS=TAP::Harness::Restricted cpan Dist::Zilla
# using cpanm, bypassing *all* tests
$ cpanm -n Dist::Zilla
In either case, it's probably going to take about 10 minutes. Go for a walk,
go get a cup of your favorite beverage, take a bathroom break, or whatever.
When you get back, Dist::Zilla should be ready for you.
Then you need to install any plugins specific to this distribution:
$ dzil authordeps --missing | cpanm
You can use Dist::Zilla to install the distribution's dependencies if you
haven't already installed them with cpanm:
$ dzil listdeps --missing --develop | cpanm
Once everything is installed, here are some dzil commands you might try:
$ dzil build
$ dzil test
$ dzil regenerate
You can learn more about Dist::Zilla at http://dzil.org/
## Other notes
This distribution maintains the generated `META.json` and either `Makefile.PL`
or `Build.PL` in the repository. This allows two things:
[Travis CI](https://travis-ci.org/) can build and test the distribution without
requiring Dist::Zilla, and the distribution can be installed directly from
Github or a local git repository using `cpanm` for testing (again, not
requiring Dist::Zilla).
$ cpanm git://github.com/Author/Distribution-Name.git
$ cd Distribution-Name; cpanm .
Contributions are preferred in the form of a Github pull request. See
[Using pull requests](https://help.github.com/articles/using-pull-requests/)
for further information. You can use the Github issue tracker to report issues
without an accompanying patch.
# CREDITS
This file was adapted from an initial `CONTRIBUTING.mkdn` file from David
Golden under the terms of the [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/), with inspiration from the
contributing documents from [Dist::Zilla::Plugin::Author::KENTNL::CONTRIBUTING](https://metacpan.org/pod/Dist::Zilla::Plugin::Author::KENTNL::CONTRIBUTING)
and [Dist::Zilla::PluginBundle::Author::ETHER](https://metacpan.org/pod/Dist::Zilla::PluginBundle::Author::ETHER).
......@@ -28,12 +28,14 @@ patches, bug reports, help with troubleshooting, etc. A huge
* Gavin Peters
* Gisle Aas
* Graeme Thompson
* Graham Knop
* Hans-H. Froehlich
* Ian Kilgore
* Jacob J
* jefflee
* Jerome Eteve
* john9art
* jonasbn
* Karen Etheridge
* Mark Overmeer
* Mark Stosberg
......@@ -47,6 +49,8 @@ patches, bug reports, help with troubleshooting, etc. A huge
* openstrike
* Peter Rabbitson
* phrstbrn
* Robert Rothenberg
* Robert Rothenberg
* Robert Stone
* Rolf Grossmann
* ruff
......
Revision history for HTTP-Message
6.18 2018-06-05 16:29:15Z
- Revert status_message to original code (GH#111) (Theo van Hoesel)
6.17 2018-06-05 01:55:34Z
- Documented status code 451 in the list of constants (GH #104) (Robert Rothenberg)
- Status code 451 is cachable by default, as per RFC 7725 (GH #104) (Robert Rothenberg)
- Add default status_message for unknown status codes (GH#105) (Robert Rothenberg)
- Corrections to the documentation (GH#102) (Jonas B. Nielsen)
6.16 2018-03-28 14:09:17Z
- Update status codes to official IANA list (GH#100) (Theo van Hoesel)
......
# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.011.
# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012.
CONTRIBUTING.md
CONTRIBUTORS
Changes
INSTALL
......
This diff is collapsed.
This diff is collapsed.
# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.011.
# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012.
use strict;
use warnings;
......@@ -48,7 +48,7 @@ my %WriteMakefileArgs = (
"Time::Local" => 0,
"Try::Tiny" => 0
},
"VERSION" => "6.16",
"VERSION" => "6.18",
"test" => {
"TESTS" => "t/*.t"
}
......
......@@ -4,7 +4,7 @@ HTTP::Message - HTTP style message (base class)
# VERSION
version 6.16
version 6.18
# SYNOPSIS
......
libhttp-message-perl (6.18-1) unstable; urgency=medium
* Declare compliance with policy 4.1.4
* Import upstream version 6.18
-- Xavier Guimard <x.guimard@free.fr> Wed, 06 Jun 2018 06:20:54 +0200
libhttp-message-perl (6.16-1) unstable; urgency=medium
* Import upstream version 6.16
......
......@@ -12,7 +12,7 @@ Build-Depends-Indep: libencode-locale-perl,
libtry-tiny-perl,
liburi-perl,
perl
Standards-Version: 4.1.3
Standards-Version: 4.1.4
Vcs-Browser: https://salsa.debian.org/perl-team/modules/packages/libhttp-message-perl
Vcs-Git: https://salsa.debian.org/perl-team/modules/packages/libhttp-message-perl.git
Homepage: https://metacpan.org/release/HTTP-Message
......
......@@ -3,7 +3,7 @@ package HTTP::Config;
use strict;
use warnings;
our $VERSION = '6.16';
our $VERSION = '6.18';
use URI;
......@@ -245,7 +245,7 @@ HTTP::Config - Configuration for request and response objects
=head1 VERSION
version 6.16
version 6.18
=head1 SYNOPSIS
......
......@@ -3,7 +3,7 @@ package HTTP::Headers;
use strict;
use warnings;
our $VERSION = '6.16';
our $VERSION = '6.18';
use Carp ();
......@@ -475,7 +475,7 @@ HTTP::Headers - Class encapsulating HTTP Message headers
=head1 VERSION
version 6.16
version 6.18
=head1 SYNOPSIS
......
......@@ -3,7 +3,7 @@ package HTTP::Headers::Auth;
use strict;
use warnings;
our $VERSION = '6.16';
our $VERSION = '6.18';
use HTTP::Headers;
......@@ -111,7 +111,7 @@ HTTP::Headers::Auth
=head1 VERSION
version 6.16
version 6.18
=head1 AUTHOR
......
......@@ -3,7 +3,7 @@ package HTTP::Headers::ETag;
use strict;
use warnings;
our $VERSION = '6.16';
our $VERSION = '6.18';
require HTTP::Date;
......@@ -107,7 +107,7 @@ HTTP::Headers::ETag
=head1 VERSION
version 6.16
version 6.18
=head1 AUTHOR
......
......@@ -3,7 +3,7 @@ package HTTP::Headers::Util;
use strict;
use warnings;
our $VERSION = '6.16';
our $VERSION = '6.18';
use base 'Exporter';
......@@ -103,7 +103,7 @@ HTTP::Headers::Util - Header value parsing utility functions
=head1 VERSION
version 6.16
version 6.18
=head1 SYNOPSIS
......
......@@ -3,7 +3,7 @@ package HTTP::Message;
use strict;
use warnings;
our $VERSION = '6.16';
our $VERSION = '6.18';
require HTTP::Headers;
require Carp;
......@@ -781,7 +781,7 @@ HTTP::Message - HTTP style message (base class)
=head1 VERSION
version 6.16
version 6.18
=head1 SYNOPSIS
......
......@@ -3,7 +3,7 @@ package HTTP::Request;
use strict;
use warnings;
our $VERSION = '6.16';
our $VERSION = '6.18';
use base 'HTTP::Message';
......@@ -145,7 +145,7 @@ HTTP::Request - HTTP style request message
=head1 VERSION
version 6.16
version 6.18
=head1 SYNOPSIS
......
......@@ -3,7 +3,7 @@ package HTTP::Request::Common;
use strict;
use warnings;
our $VERSION = '6.16';
our $VERSION = '6.18';
our $DYNAMIC_FILE_UPLOAD ||= 0; # make it defined (don't know why)
......@@ -312,7 +312,7 @@ HTTP::Request::Common - Construct common HTTP::Request objects
=head1 VERSION
version 6.16
version 6.18
=head1 SYNOPSIS
......
......@@ -3,7 +3,7 @@ package HTTP::Response;
use strict;
use warnings;
our $VERSION = '6.16';
our $VERSION = '6.18';
use base 'HTTP::Message';
......@@ -351,7 +351,7 @@ HTTP::Response - HTTP style response message
=head1 VERSION
version 6.16
version 6.18
=head1 SYNOPSIS
......
......@@ -3,7 +3,7 @@ package HTTP::Status;
use strict;
use warnings;
our $VERSION = '6.16';
our $VERSION = '6.18';
require 5.002; # because we use prototypes
......@@ -75,7 +75,7 @@ my %StatusCode = (
# 430
431 => 'Request Header Fields Too Large', # RFC 6585: Additional Codes
# 432 .. 450
451 => 'Unavailable For Legal Reasons', # RFC 7724: Legal Obstacels
451 => 'Unavailable For Legal Reasons', # RFC 7724: Legal Obstacles
# 452 .. 499
500 => 'Internal Server Error',
501 => 'Not Implemented',
......@@ -135,19 +135,20 @@ sub is_redirect ($) { $_[0] && $_[0] >= 300 && $_[0] < 400; }
sub is_error ($) { $_[0] && $_[0] >= 400 && $_[0] < 600; }
sub is_client_error ($) { $_[0] && $_[0] >= 400 && $_[0] < 500; }
sub is_server_error ($) { $_[0] && $_[0] >= 500 && $_[0] < 600; }
sub is_cacheable_by_default ($) { $_[0] &&
( $_[0] == 200 # OK
|| $_[0] == 203 # Non-Authoritative Information
|| $_[0] == 204 # No Content
|| $_[0] == 206 # Not Acceptable
|| $_[0] == 300 # Multiple Choices
|| $_[0] == 301 # Moved Permanently
|| $_[0] == 404 # Not Found
|| $_[0] == 405 # Method Not Allowed
|| $_[0] == 410 # Gone
|| $_[0] == 414 # Request-URI Too Large
|| $_[0] == 501 # Not Implemented
); }
sub is_cacheable_by_default ($) { $_[0] && ( $_[0] == 200 # OK
|| $_[0] == 203 # Non-Authoritative Information
|| $_[0] == 204 # No Content
|| $_[0] == 206 # Not Acceptable
|| $_[0] == 300 # Multiple Choices
|| $_[0] == 301 # Moved Permanently
|| $_[0] == 404 # Not Found
|| $_[0] == 405 # Method Not Allowed
|| $_[0] == 410 # Gone
|| $_[0] == 414 # Request-URI Too Large
|| $_[0] == 451 # Unavailable For Legal Reasons
|| $_[0] == 501 # Not Implemented
);
}
1;
......@@ -161,7 +162,7 @@ HTTP::Status - HTTP Status code processing
=head1 VERSION
version 6.16
version 6.18
=head1 SYNOPSIS
......@@ -201,7 +202,9 @@ tag to import them all.
HTTP_RESET_CONTENT (205)
HTTP_PARTIAL_CONTENT (206)
HTTP_MULTI_STATUS (207)
HTTP_ALREADY_REPORTED (208)
HTTP_ALREADY_REPORTED (208)
HTTP_IM_USED (226)
HTTP_MULTIPLE_CHOICES (300)
HTTP_MOVED_PERMANENTLY (301)
......@@ -230,16 +233,15 @@ tag to import them all.
HTTP_UNSUPPORTED_MEDIA_TYPE (415)
HTTP_REQUEST_RANGE_NOT_SATISFIABLE (416)
HTTP_EXPECTATION_FAILED (417)
HTTP_I_AM_A_TEAPOT (418)
HTTP_MISDIRECTED REQUEST (421)
HTTP_UNPROCESSABLE_ENTITY (422)
HTTP_LOCKED (423)
HTTP_FAILED_DEPENDENCY (424)
HTTP_NO_CODE (425)
HTTP_UPGRADE_REQUIRED (426)
HTTP_PRECONDITION_REQUIRED (428)
HTTP_TOO_MANY_REQUESTS (429)
HTTP_PRECONDITION_REQUIRED (428)
HTTP_TOO_MANY_REQUESTS (429)
HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE (431)
HTTP_RETRY_WITH (449)
HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451)
HTTP_INTERNAL_SERVER_ERROR (500)
HTTP_NOT_IMPLEMENTED (501)
......@@ -249,7 +251,7 @@ tag to import them all.
HTTP_HTTP_VERSION_NOT_SUPPORTED (505)
HTTP_VARIANT_ALSO_NEGOTIATES (506)
HTTP_INSUFFICIENT_STORAGE (507)
HTTP_BANDWIDTH_LIMIT_EXCEEDED (509)
HTTP_LOOP_DETECTED (508)
HTTP_NOT_EXTENDED (510)
HTTP_NETWORK_AUTHENTICATION_REQUIRED (511)
......@@ -265,7 +267,9 @@ the classification functions.
The status_message() function will translate status codes to human
readable strings. The string is the same as found in the constant
names above. If the $code is unknown, then C<undef> is returned.
names above. If the $code is not registered in the L<list of IANA HTTP Status
Codes|https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml>
then C<undef> is returned.
=item is_info( $code )
......@@ -308,13 +312,17 @@ This function is B<not> exported by default.
Return TRUE if C<$code> indicates that a response is cacheable by default, and
it can be reused by a cache with heuristic expiration. All other status codes
are not cacheable by default. See L<RFC 7231 - HTTP/1.1 Semantics and Content,
are not cacheable by default. See L<RFC 7231 - HTTP/1.1 Semantics and Content,
Section 6.1. Overview of Status Codes|https://tools.ietf.org/html/rfc7231#section-6.1>.
This function is B<not> exported by default.
=back
=head1 SEE ALSO
L<IANA HTTP Status Codes|https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml>
=head1 BUGS
For legacy reasons all the C<HTTP_> constants are exported by default
......
......@@ -2,7 +2,7 @@ use strict;
use warnings;
use Test::More;
plan tests => 36;
plan tests => 39;
use HTTP::Status qw(:constants :is status_message);
......@@ -17,8 +17,11 @@ ok(is_redirect(HTTP_PERMANENT_REDIRECT));
ok(!is_success(HTTP_NOT_FOUND));
is(status_message(0), undef);
is(status_message( 0), undef);
is(status_message(200), "OK");
is(status_message(404), "Not Found");
is(status_message(999), undef);
ok(!is_info(HTTP_NOT_FOUND));
ok(!is_success(HTTP_NOT_FOUND));
......@@ -33,7 +36,7 @@ ok(!is_redirect(99));
ok(is_cacheable_by_default($_),
"Cacheable by default [$_] " . status_message($_)
) for (200,203,204,206,300,301,404,405,410,414,501);
) for (200,203,204,206,300,301,404,405,410,414,451,501);
ok(!is_cacheable_by_default($_),
"... is not cacheable [$_] " . status_message($_)
......