Skip to content

Commit

Permalink
support for secure cookies (pulled from webpy.dev)
Browse files Browse the repository at this point in the history
  • Loading branch information
anandology committed Dec 15, 2007
1 parent 44845e3 commit 7223775
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web/webapi.py
Expand Up @@ -123,13 +123,15 @@ def data():
ctx.data = ctx.env['wsgi.input'].read(cl)
return ctx.data

def setcookie(name, value, expires="", domain=None):
def setcookie(name, value, expires="", domain=None, secure=False):
"""Sets a cookie."""
if expires < 0:
expires = -1000000000
kargs = {'expires': expires, 'path':'/'}
if domain:
kargs['domain'] = domain
if secure:
kargs['secure'] = secure
# @@ should we limit cookies to a different path?
cookie = Cookie.SimpleCookie()
cookie[name] = value
Expand Down

0 comments on commit 7223775

Please sign in to comment.