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

cookie secure has to be false with http access #73

Merged
merged 1 commit into from
Oct 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions examples/poem/redis-session/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,8 @@ use redis::{aio::ConnectionManager, Client};

#[handler]
async fn count(session: &Session) -> String {
let count = match session.get::<i32>("count") {
Some(value) => {
let count = value + 1;
session.set("count", count);
count
}
None => {
session.set("count", 1);
1
}
};

let count = session.get::<i32>("count").unwrap_or(0) + 1;
session.set("count", count);
format!("Hello!\nHow many times have seen you: {}", count)
}

Expand All @@ -33,7 +23,7 @@ async fn main() -> Result<(), std::io::Error> {
let client = Client::open("redis://127.0.0.1/").unwrap();

let app = Route::new().at("/", get(count)).with(ServerSession::new(
CookieConfig::default(),
CookieConfig::default().secure(false),
RedisStorage::new(ConnectionManager::new(client).await.unwrap()),
));
let listener = TcpListener::bind("127.0.0.1:3000");
Expand Down