{"action":"created","issue":{"url":"https://api.github.com/repos/fengsp/flask-session/issues/19","labels_url":"https://api.github.com/repos/fengsp/flask-session/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/fengsp/flask-session/issues/19/comments","events_url":"https://api.github.com/repos/fengsp/flask-session/issues/19/events","html_url":"https://github.com/fengsp/flask-session/issues/19","id":106062392,"number":19,"title":"Session is established and saved for each new request","user":{"login":"rmoorman","id":219695,"avatar_url":"https://avatars.githubusercontent.com/u/219695?v=3","gravatar_id":"","url":"https://api.github.com/users/rmoorman","html_url":"https://github.com/rmoorman","followers_url":"https://api.github.com/users/rmoorman/followers","following_url":"https://api.github.com/users/rmoorman/following{/other_user}","gists_url":"https://api.github.com/users/rmoorman/gists{/gist_id}","starred_url":"https://api.github.com/users/rmoorman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmoorman/subscriptions","organizations_url":"https://api.github.com/users/rmoorman/orgs","repos_url":"https://api.github.com/users/rmoorman/repos","events_url":"https://api.github.com/users/rmoorman/events{/privacy}","received_events_url":"https://api.github.com/users/rmoorman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-11T18:03:49Z","updated_at":"2015-09-15T06:29:16Z","closed_at":"2015-09-15T05:10:12Z","body":"I just noticed this behavior while using the Filesystem sessions of Flask-Session. On each new request, a new session file is written with a new key.\r\n\r\nTake the following example application\r\n\r\n~~~~~.python\r\nfrom flask import Flask\r\nfrom flask.ext.session import Session\r\n\r\napp = Flask(__name__)\r\napp.config[\"SECRET_KEY\"] = \"__replacewithsomethingunique__\"\r\napp.config[\"SESSION_TYPE\"] = \"filesystem\"\r\n\r\nSession(app)\r\n\r\napp.run(port=8001)\r\n~~~~~\r\n\r\nWhen I run this code and issue several curl requests, I receive a different session cookie header on each request. \r\n\r\n~~~~~\r\n$ curl -is localhost:8001 | grep Set-Cookie\r\nSet-Cookie: session=2a2d9266-deaa-4412-82de-48193503534e; Expires=Mon, 12-Oct-2015 17:46:02 GMT; HttpOnly; Path=/\r\n\r\n$ curl -is localhost:8001 | grep Set-Cookie\r\nSet-Cookie: session=a98eebd4-909c-4c42-b68c-3cae7750e390; Expires=Mon, 12-Oct-2015 17:46:02 GMT; HttpOnly; Path=/\r\n\r\n$ curl -is localhost:8001 | grep Set-Cookie\r\nSet-Cookie: session=e547e8d2-54de-4359-a4a5-bcf206e88c1e; Expires=Mon, 12-Oct-2015 17:46:03 GMT; HttpOnly; Path=/\r\n\r\n$ curl -is localhost:8001 | grep Set-Cookie\r\nSet-Cookie: session=69e78241-5c2e-4bf4-936d-35931cb81e8c; Expires=Mon, 12-Oct-2015 17:46:03 GMT; HttpOnly; Path=/\r\n~~~~~\r\n\r\nAfter which the flask_session directory is filled with several session files\r\n\r\n~~~~~\r\n$ ls -1 flask_session/\r\n113e38a76a00f2ebb4912fa547d75ec9\r\n3184c223a385dd63ce728b9e8b778f5a\r\na62fce576b1734cc77fdd1302e815916\r\nb242e7911524d66023836aaf9847b6fd\r\n~~~~~\r\n\r\nThis differs from the default flask session behavior. By default flask does not send a Set-Cookie header if nothing happens to the session.\r\nObviously this could cause some trouble.\r\n\r\nIf you have more question about this issue or if there is something else I can do to help solving it please let me know."},"comment":{"url":"https://api.github.com/repos/fengsp/flask-session/issues/comments/140292937","html_url":"https://github.com/fengsp/flask-session/issues/19#issuecomment-140292937","issue_url":"https://api.github.com/repos/fengsp/flask-session/issues/19","id":140292937,"user":{"login":"fengsp","id":2986070,"avatar_url":"https://avatars.githubusercontent.com/u/2986070?v=3","gravatar_id":"","url":"https://api.github.com/users/fengsp","html_url":"https://github.com/fengsp","followers_url":"https://api.github.com/users/fengsp/followers","following_url":"https://api.github.com/users/fengsp/following{/other_user}","gists_url":"https://api.github.com/users/fengsp/gists{/gist_id}","starred_url":"https://api.github.com/users/fengsp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fengsp/subscriptions","organizations_url":"https://api.github.com/users/fengsp/orgs","repos_url":"https://api.github.com/users/fengsp/repos","events_url":"https://api.github.com/users/fengsp/events{/privacy}","received_events_url":"https://api.github.com/users/fengsp/received_events","type":"User","site_admin":false},"created_at":"2015-09-15T06:29:16Z","updated_at":"2015-09-15T06:29:16Z","body":"Show me the code, all of them."}}