Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tornado: Explicitly mark requests as varying by cookie.
Alex Vandiver4f6fc728cd8e
diff --git a/zerver/tests/test_tornado.py b/zerver/tests/test_tornado.pyindex ca428d741b7..a564c97ee1a 100644--- a/zerver/tests/test_tornado.py+++ b/zerver/tests/test_tornado.py@@ -117,6 +117,7 @@ class EventsTestCase(TornadoWebTestCase):self.io_loop.call_later(0.1, process_events)response = self.wait()+ self.assertEqual(response.headers["Vary"], "Accept-Language, Cookie")data = orjson.loads(response.body)self.assertEqual(data["events"],diff --git a/zerver/tornado/handlers.py b/zerver/tornado/handlers.pyindex c0b4c0a1b88..3f3b99c910b 100644--- a/zerver/tornado/handlers.py+++ b/zerver/tornado/handlers.py@@ -9,6 +9,7 @@ from django.core.handlers import basefrom django.core.handlers.wsgi import WSGIRequest, get_script_namefrom django.http import HttpRequest, HttpResponsefrom django.urls import set_script_prefix+from django.utils.cache import patch_vary_headersfrom tornado.wsgi import WSGIContainerfrom zerver.lib.response import json_response@@ -243,6 +244,9 @@ class AsyncDjangoHandler(tornado.web.RequestHandler, base.BaseHandler):try:response = self.get_response(request)+ # Explicitly mark requests as varying by cookie, since the+ # middleware will not have seen a session access+ patch_vary_headers(response, ("Cookie",))finally:# Tell Django we're done processing this request#