Skip to content

Commit

Permalink
Merge pull request #844 from w3c/fix-cookie
Browse files Browse the repository at this point in the history
the HTTP interface expects a date, not a string containing a date
  • Loading branch information
zqzhang committed Apr 10, 2014
2 parents 2210b4e + e58b9b6 commit 96310df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion eventsource/resources/cors-cookie.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from datetime import datetime

def main(request, response):
last_event_id = request.headers.get("Last-Event-Id", "")
ident = request.GET.first('ident', "test")
Expand All @@ -19,7 +21,8 @@ def main(request, response):
data = "id: 1\nretry: 200\ndata: first %s\n\n" % cookie
elif last_event_id == '1':
headers.append(("Content-Type", "text/event-stream"))
response.set_cookie(ident, "COOKIE", expires="Fri, 27 Jul 2001 02:47:11 UTC")
long_long_time_ago = datetime.now().replace(year=2001, month=7, day=27)
response.set_cookie(ident, "COOKIE", expires=long_long_time_ago)
data = "id: 2\ndata: second %s\n\n" % cookie
else:
headers.append(("Content-Type", "stop"))
Expand Down

0 comments on commit 96310df

Please sign in to comment.