De-stale c.site for stylesheet requests.

Since we're using nginx in front of subreddit stylesheets
to protect ourselves from ponies, we need to make sure we
don't give a stale copy of the CSS when requested with the
new query param thereby poisoning nginx's cache.
This commit is contained in:
Neil Williams
2012-05-10 21:34:12 -07:00
parent e6555cf680
commit a0f37adb13

View File

@@ -358,6 +358,10 @@ class FrontController(RedditController):
return res
def GET_stylesheet(self):
# de-stale the subreddit object so we don't poison nginx's cache
if not isinstance(c.site, FakeSubreddit):
c.site = Subreddit._byID(c.site._id, data=True, stale=False)
if hasattr(c.site,'stylesheet_contents') and not g.css_killswitch:
c.allow_loggedin_cache = True
self.check_modified(c.site,'stylesheet_contents',