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

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

Comments

Projects
None yet
3 participants
@DrHyde
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@racke

racke Apr 7, 2014

Member

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.

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

This comment has been minimized.

Show comment
Hide comment
@racke

racke Apr 7, 2014

Member

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;
+};
+
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;
+};
+

@yanick yanick added Bug labels Aug 24, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment