Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETag support via middleware failed for HEAD requests. #1410

Closed
amaxcz opened this issue Dec 7, 2017 · 4 comments
Closed

ETag support via middleware failed for HEAD requests. #1410

amaxcz opened this issue Dec 7, 2017 · 4 comments

Comments

@amaxcz
Copy link

amaxcz commented Dec 7, 2017

Please add the support for ETags? Also, there is should be a way to specify params for Plack::Middleware::ETag

--- App.pm.orig 2017-03-10 22:38:06.000000000 +0100
+++ App.pm      2017-12-07 12:18:54.875253693 +0100
@@ -17,6 +17,7 @@
 use Plack::Middleware::Head;
 use Plack::Middleware::Conditional;
 use Plack::Middleware::ConditionalGET;
+use Plack::Middleware::ETag;

 use Dancer2::FileUtils 'path';
 use Dancer2::Core;
@@ -1400,6 +1401,11 @@
     # FixMissingBodyInRedirect
     $psgi = Plack::Middleware::FixMissingBodyInRedirect->wrap( $psgi );

+       # Add experimental ETag support. This should be implemented properly!
+    $psgi = Plack::Middleware::ETag->wrap( $psgi );
+    $psgi = Plack::Middleware::ConditionalGET->wrap( $psgi );
+
+
     # Only add static content handler if requires
     if ( $self->config->{'static_handler'} ) {
         # Use App::File to "serve" the static content
 

@amaxcz
Copy link
Author

amaxcz commented Dec 7, 2017

Suggested fix is here because now, Dancer2 isn't ready to serve Etags for HEAD requests (even via builder). Because HEAD requests drops body, so etags calculation for HEAD requests is not working absolutely. That is a problem.

@amaxcz
Copy link
Author

amaxcz commented Dec 7, 2017

also we SHOULD calculate Etags before ConditionalGET. and before dropping body on the HEAD requests..
so... Please implement ETag support, it's important.

@amaxcz
Copy link
Author

amaxcz commented Dec 7, 2017

Linked bugs are:
plack/Plack#606
plack/Plack#605

@cromedome
Copy link
Contributor

Resolved by #1459. Closing!

cromedome added a commit that referenced this issue Nov 14, 2018
    [ BUG FIXES ]
    * GH #1427: Allow layout_dir to be configured by set keyword (Russell
      @veryrusty Jenkins)
    * GH #1456: Engine logging respects minimum level filtering (Daniel Perrett)
    * PR #1479: Remove arbitrary Perl 5.10 requirement from tests (Dan Book)
    * PR #1480: Correct dynamic HTTP::XSCookies requirement (Dan Book)
    * PR #1486: Install dzil deps for use by Appveyor (Dan Book)

    [ ENHANCEMENTS ]
    * GH #1418: Send plain text content with send_as() (Steve Dondley)
    * PR #1457: Serializer mutable with custom mapping. Also resolves issues
      #795, #973, and #901 (Russell @veryrusty Jenkins, Yanick Champoux,
      Daniel Böhmer, Steven Humphrey)
    * PR #1459: Add no default middleware feature. Also resolves #1410
      (Russell @veryrusty Jenkins)
    * GH #1469: Code of Conduct enhancements (MaxPerl)

    [ DOCUMENTATION ]
    * GH #1166: Add behind_proxy docs to Deployment manual (Nuno Ramos
      Carvalho)
    * GH #1417: Add "set engines" documentation (Deirdre Moran)
    * PR #1450: Add calculator example (Gabor Szabo)
    * PR #1452: Fix Pod formatting for CPAN (simbaque)
    * PR #1454: Fix typos in docs (Gil Magno)
    * PR #1464: Can't set environment with 'set' keyword (Ben Kaufman)
    * PR #1470: Use session for flash and explain in detail (simbaque)
    * PR #1472: Migration, tutorial, other doc fixes (Jason A. Crome)
    * PR #1473: Show support resources after generating new app (Jason A.
      Crome)
    * PR #1474: Use the correct URL for HAProxy (Jason A. Crome)
    * PR #1475: Add manual section for security concerns (Jason A. Crome)
    * PR #1487: Clarify deprecation of Dancer2::Test (Steve Dondley)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants