Skip to content

Is there any reason why get and get_private CookieJar functions have a different return value? #2639

Answered by SergioBenitez
Luni-4 asked this question in Questions
Discussion options

You must be logged in to vote

Yes. get() returns a cookie where the internal value borrows from the request, since its value is identical (modulo percent decoding, which we cache) to what the client sent. get_private() fetches a private cookie, whose value, on the other hand, is encrypted (and signed). The logical value, the decrypted value, is thus different than the value already in memory, and thus we cannot borrow it from the request. We must allocate to store said value, hence the owned-ness of the returned Cookie.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Luni-4
Comment options

Answer selected by Luni-4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants