Skip to content

Use of send_file() prohibits any more updates to the user's cookie #886

Open
DrHyde opened this Issue Feb 5, 2013 · 2 comments

3 participants

@DrHyde
DrHyde commented Feb 5, 2013

Ideally, I'd like to see send_file()'s actions postponed until after all hooks have run, but failing that, the doco should be updated to note that anything that may cause the user's cookie to change, including any changes to their session() can't be done after send_file()

@racke
PerlDancer member
racke commented Apr 7, 2014

This is annoying and session() doesn't really change the cookie at this point. Also you cannot find out from response object if a send_file call happened.

@racke
PerlDancer member
racke commented Apr 7, 2014

We did the following workaround in our code:

hook after => sub {
     if (status == 200) {
+        return if var('no_session');
         log_page(request->path);
     }
 };

+hook after_file_render => sub {
+    my $res = shift;
+    var no_session => 1;
+};
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.