ktorio / ktor

Framework for quickly creating connected applications in Kotlin with minimal effort
https://ktor.io
Apache License 2.0
12.71k stars 1.04k forks source link

Session cookie with BASE64 encoding fails to set correct cookie #1447

Closed AndreasVolkmann closed 1 year ago

AndreasVolkmann commented 4 years ago

Ktor Version and Engine Used (client or server and name) 1.2.5 and 1.3.0-beta-1, server, netty and CIO

Describe the bug When using the base64 encoding for a session cookie, the correct cookie is not picked up.

In my repro example below I am basically calling /login, which sets the session, and then /, where the session is evaluated. When using base64 encoding, the second call doesn't succeed, as no session is found.

Important to notice that this works with all other encodings, and even with base64 in the test engine.

To Reproduce Minimal repro here: https://github.com/AndreasVolkmann/ktor-session

Steps to reproduce the behavior:

  1. Start the server
  2. Go to localhost:5000/login which should return Logged in and set the session / cookie.
  3. Go to localhost:5000 where an error is shown

When changing the encoding, the above scenario works.

Expected behavior The session cookie should be set and valid for the next call, just like with all other encodings and under test.

Tested with multiple browsers and postman.

oleg-larshin commented 4 years ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.