gunicorn/examples/frameworks/tornadoapp.py
Benoit Chesneau 4b9d787c93 tornado: Require Tornado 6.5.0+ for security fixes
Update minimum Tornado version to 6.5.0 to address:
- CVE-2024-52804 (Medium): HTTP Cookie Parsing DoS
- CVE-2025-47287 (High 7.5): Multipart/Form-Data Parser DoS

This simplifies the tornado worker by removing legacy code paths
for Tornado < 5.0 and < 6.0, reducing the codebase by ~30%.

Changes:
- pyproject.toml: Update tornado requirement to >=6.5.0
- gtornado.py: Remove TORNADO5 constant and legacy code paths
- tornadoapp.py: Update example to use async/await syntax
- test_gtornado.py: Add comprehensive test suite
2026-01-23 00:02:01 +01:00

34 lines
644 B
Python

#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
#
# Run with:
#
# $ gunicorn -k tornado tornadoapp:app
#
import asyncio
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
async def get(self):
# Your asynchronous code here
await asyncio.sleep(1) # Example of an asynchronous operation
self.write("Hello, World!")
def make_app():
return tornado.web.Application([
(r"/", MainHandler),
])
app = make_app()
if __name__ == "__main__":
app.listen(8888)
tornado.ioloop.IOLoop.current().start()