-
Notifications
You must be signed in to change notification settings - Fork 20
Do not return new cookies when session isn’t changed #53
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -243,7 +243,13 @@ def unpacked_cookie_data(request) | |
| end | ||
| end | ||
|
|
||
| request.set_header(k, session_data || {}) | ||
| if session_data | ||
| request.set_header(RACK_SESSION_WAS, session_data.dup) | ||
| request.set_header(k, session_data) | ||
| else | ||
| request.set_header(RACK_SESSION_WAS, nil) | ||
| request.set_header(k, {}) | ||
| end | ||
| end | ||
| end | ||
|
|
||
|
|
@@ -253,6 +259,14 @@ def persistent_session_id!(data, sid = nil) | |
| data | ||
| end | ||
|
|
||
| def set_cookie(request, response, cookie) | ||
| return if request.session.to_h == request.get_header(RACK_SESSION_WAS) && | ||
| !request.get_header(RACK_SESSION_OPTIONS).fetch(:renew, false) && | ||
| !cookie[:expires] | ||
|
||
|
|
||
| response.set_cookie(@key, cookie) | ||
| end | ||
|
|
||
| class SessionId < DelegateClass(Session::SessionId) | ||
| attr_reader :cookie_value | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.