﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20755	Certain cookie flags don't get unpickled properly	Julien Phalip	Julien Phalip	"I've noticed that some cookie flags (at least `httponly` and `secure`) do not properly get unpickled. This is an issue particularly for `FetchFromCacheMiddleware` when it unpickles a cached response object.

So far I've narrowed down the issue to this snippet of code:

{{{#!python
import pickle
from django.http import HttpResponse

original = HttpResponse()
original.set_cookie('foo', 'bar', path='/blah', httponly=True, secure=True)

pickled = pickle.dumps(original, pickle.HIGHEST_PROTOCOL)
reloaded = pickle.loads(pickled)

# httponly and secure get lost in the pickle loading process!!
original.cookies['foo']['httponly']   # True
reloaded.cookies['foo']['httponly']   # ''

original.cookies['foo']['secure']     # True
reloaded.cookies['foo']['secure']     # ''

str(original.cookies)                 # 'Set-Cookie: foo=bar; httponly; Path=/blah; secure'
str(reloaded.cookies)                 # 'Set-Cookie: foo=bar; Path=/blah'
}}}

At this stage I'm unsure if it's a bug in Django or in Python. For the record, I've tested this with Python 2.7.5."	Bug	closed	HTTP handling	dev	Normal	wontfix			Accepted	0	0	0	0	0	0
