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

Session state can't be read in stream of streaming response #290

Open
mohe2015 opened this issue Sep 21, 2022 · 0 comments
Open

Session state can't be read in stream of streaming response #290

mohe2015 opened this issue Sep 21, 2022 · 0 comments
Labels
A-session Project: actix-session C-improvement Category: an improvement to existing functionality

Comments

@mohe2015
Copy link
Contributor

Expected Behavior

https://github.com/mohe2015/actix-extras-285/blob/main/src/main.rs
If I didn't mess anything up in a perfect world I would expect the set-broken to either not compile or to panic. Also I would expect the get-broken to either work or to not compile or to panic.

Current Behavior

To my understanding currently reading the session in a stream silently doesn't contain the data of the session. It is clear though that setting the data in the stream is not supposed to work as the headers have already been sent (potentially). Currently it silently discards that session data.

Possible Solution

I think the best thing would be either prevent this to compile (don't know if this is possible) and then force the user to retrieve that data outside of the stream or to allow reading the data but panic on setting the data. Don't know how this works implementation wise though.

Steps to Reproduce (for bugs)

  1. Run https://github.com/mohe2015/actix-extras-285
  2. Follow the steps in the code: https://github.com/mohe2015/actix-extras-285/blob/4ff4b71d113423d604875920a54bff6c6ec31fc8/src/main.rs#L54
  3. See that the broken endpoints don't return the session or don't change the session.

Context

I was wondering where my session data went when reading it. Debugging this was really weird because first I thought CORS is at fault.

Your Environment

  • Rust Version (I.e, output of rustc -V): rustc 1.65.0-nightly (750bd1a7f 2022-09-14)
  • Actix-* crate(s) Version: actix-web v4.2.1, actix-session v0.7.2

XREF #285 (docs may need adjustment then)

@robjtede robjtede added C-improvement Category: an improvement to existing functionality A-session Project: actix-session labels Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-session Project: actix-session C-improvement Category: an improvement to existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants