--- a/web/http_headers.py Fri Oct 17 18:16:58 2014 +0200
+++ b/web/http_headers.py Tue Jul 15 16:07:59 2014 +0200
@@ -934,9 +934,13 @@
#### Cookies. Blech!
class Cookie(object):
- # __slots__ = ['name', 'value', 'path', 'domain', 'ports', 'expires', 'discard', 'secure', 'comment', 'commenturl', 'version']
+ # __slots__ = ['name', 'value', 'path', 'domain', 'ports', 'expires',
+ # 'discard', 'secure', 'httponly', 'comment', 'commenturl',
+ # 'version']
- def __init__(self, name, value, path=None, domain=None, ports=None, expires=None, discard=False, secure=False, comment=None, commenturl=None, version=0):
+ def __init__(self, name, value, path=None, domain=None, ports=None,
+ expires=None, discard=False, secure=False, httponly=False,
+ comment=None, commenturl=None, version=0):
self.name = name
self.value = value
self.path = path
@@ -945,6 +949,7 @@
self.expires = expires
self.discard = discard
self.secure = secure
+ self.httponly = httponly
self.comment = comment
self.commenturl = commenturl
self.version = version
@@ -955,7 +960,8 @@
if self.domain is not None: s+=", domain=%r" % (self.domain,)
if self.ports is not None: s+=", ports=%r" % (self.ports,)
if self.expires is not None: s+=", expires=%r" % (self.expires,)
- if self.secure is not False: s+=", secure=%r" % (self.secure,)
+ if self.secure: s+=", secure"
+ if self.httponly: s+=", HttpOnly"
if self.comment is not None: s+=", comment=%r" % (self.comment,)
if self.commenturl is not None: s+=", commenturl=%r" % (self.commenturl,)
if self.version != 0: s+=", version=%r" % (self.version,)
@@ -1213,6 +1219,8 @@
out.append("domain=%s" % cookie.domain)
if cookie.secure:
out.append("secure")
+ if cookie.httponly:
+ out.append("HttpOnly")
setCookies.append('; '.join(out))
return setCookies
@@ -1240,6 +1248,8 @@
out.append("Port=%s" % quoteString(",".join([str(x) for x in cookie.ports])))
if cookie.secure:
out.append("Secure")
+ if cookie.httponly:
+ out.append("HttpOnly")
out.append('Version="1"')
setCookies.append('; '.join(out))
return setCookies