perl - How can I not send a cookie when I use the Cache-Control header in Catalyst? -
After the
I am using the session in my catalytic application via the session
, Session :: Store :: DBIC
, and Session :: State :: Cookie
.
I have to send some controllers and methods out of data with a cache-control: public
header, so it is important that the set-cookie: < / Code> header not go out with those reactions (otherwise, it will be cached and the other will be sent to the customers, leading to possible security issues). I do not have any good way to accomplish this.
How can I not send sessions
or session :: state :: cookie
in response to a given request cookie?
A little RTFS, Session.pm
override catalyst the finalize_headers
method and a rather sets there cookie through deep Call series:
finalize_header ⇒ _save_session_expires ⇒ session_expires ⇒ _extended_session_expires ⇒ extend_session_id (...: : Session :: state :: cookie) update_session_cookie (... :: session :: state :: cookie)
⇒
It does not seem to be from. Cookie.pm cookie_is_rejecting
is a method in which the cookie path is configured only to the request path.
So, the best way to do it looks like it is that I may override either update_session_cookie
or cookie_is_rejecting
.
Here is the code that I used in the end. Note that this is all black, but it works ...
Package Activator :: Plugin :: Session :: State :: Cookie :: Unmatched; Use base qw / catalyst :: plugin :: session :: state :: cookie /; MRO :: Compat; Strict use; Sub-cookie_is_rejecting {my ($ c, $ cookie) = @_; ($ C-> Stash-> {cache_control_time} // 0) & gt; 0 or $ c-> Maybe :: Next :: Method ($ c, $ cookie); } 1;
Comments
Post a Comment