From d9ac4e27eba3954b6cc3f6fb0db97e344ebab006 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 7 Jul 2015 11:34:40 -0700 Subject: Rewrite the README. And convert it to markdown. --- README | 53 ---------------------------------------------- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 53 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index 2d9ddfa..0000000 --- a/README +++ /dev/null @@ -1,53 +0,0 @@ -NAME - Plack::Middleware::ETag - Adds automatically an ETag header. - -SYNOPSIS - use Plack::Builder; - - my $app = builder { - enable "Plack::Middleware::ETag", file_etag => [qw/inode mtime size/]; - sub {['200', ['Content-Type' => 'text/html'}, ['hello world']]}; - }; - -DESCRIPTION - Plack::Middleware::ETag adds automatically an ETag header. You may want - to use it with "Plack::Middleware::ConditionalGET". - - my $app = builder { - enable "Plack::Middleware::ConditionalGET"; - enable "Plack::Middleware::ETag", file_etag => "inode"; - sub {['200', ['Content-Type' => 'text/html'}, ['hello world']]}; - }; - - CONFIGURATION - file_etag - If the content is a file handle, the ETag will be set using the - inode, modified time and the file size. You can select which - attributes of the file will be used to set the ETag: - - enable "Plack::Middleware::ETag", file_etag => [qw/size/]; - - cache_control - It's possible to add 'Cache-Control' header. - - enable "Plack::Middleware::ETag", cache_control => 1; - - Will add "Cache-Control: must-revalidate" to the headers. - - enable "Plack::Middleware::ETag", cache_control => [ 'must-revalidate', 'max-age=3600' ]; - - Will add "Cache-Control: must-revalidate, max-age=3600" to the - headers. - - check_last_modified_header - - Will not add an ETag if there is already a Last-Modified header. - -AUTHOR - franck cuny - -SEE ALSO -LICENSE - This library is free software; you can redistribute it and/or modify it - under the same terms as Perl itself. - diff --git a/README.md b/README.md new file mode 100644 index 0000000..1d40803 --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +Plack::Middleware::ETag - Adds automatically an ETag header. + +[![Build +Status](https://travis-ci.org/franckcuny/plack-middleware-etag.svg?branch=travis-ci)](https://travis-ci.org/franckcuny/plack-middleware-etag) + +## SYNOPSIS + +```perl +use Plack::Builder; + +my $app = builder { + enable "Plack::Middleware::ETag", file_etag => [qw/inode mtime size/]; + sub {['200', ['Content-Type' => 'text/html'}, ['hello world']]}; +}; +``` + +## DESCRIPTION + +Plack::Middleware::ETag adds automatically an ETag header. You may want to use it with +"Plack::Middleware::ConditionalGET". + +```perl +my $app = builder { + enable "Plack::Middleware::ConditionalGET"; + enable "Plack::Middleware::ETag", file_etag => "inode"; + sub {['200', ['Content-Type' => 'text/html'}, ['hello world']]}; +}; +``` + +## CONFIGURATION + +### file_etag + +If the content is a file handle, the ETag will be set using the +inode, modified time and the file size. You can select which +attributes of the file will be used to set the ETag: + +```perl +enable "Plack::Middleware::ETag", file_etag => [qw/size/]; +``` + +### cache_control + +It's possible to add 'Cache-Control' header. + +```perl +enable "Plack::Middleware::ETag", cache_control => 1; +``` + +Will add "Cache-Control: must-revalidate" to the headers. + +```perl +enable "Plack::Middleware::ETag", cache_control => [ 'must-revalidate', 'max-age=3600' ]; +``` + +Will add "Cache-Control: must-revalidate, max-age=3600" to the headers. + +```perl +check_last_modified_header +``` + +Will not add an ETag if there is already a Last-Modified header. + +## AUTHOR + +Franck Cuny + +## LICENSE + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + -- cgit 1.4.1