HttpRequest: An unsung hero of Django
summary
Django’s HttpRequest actually parses and normalizes headers (case and hyphen/underscore quirks), parses Content-Type and Accept, exposes request.body with safeguards (prevents double reads, enforces max upload size and spooling), provides get_host and allowed hosts checks, builds safe full and absolute URLs (IRI→URI, dot-dot cleanup), unifies scheme across WSGI/ASGI, parses POST/files via upload handlers, and offers signed cookie helpers — concrete protections and utilities you get without reimplementing each edge case.
AI-written summary · about
chapters (19)
- 0:00Introduction and speaker background
- 2:08Django's protection through the request object
- 3:54Handling headers in Django requests
- 7:04Host header and security protections
- 8:54URL path handling and edge cases
- 10:17Detecting HTTPS and scheme resolution
- 11:42Building absolute URLs safely
- 12:45Reading and parsing request content
- 14:12Content encoding and charset handling
- 14:54Processing POST data and files
- 16:38File upload limits and handlers
- 17:22Cookie handling and signed cookies
- 19:29Q&A: Cookie handling improvements
- 20:52Q&A: Comparing HTTP request implementations
- 22:38Q&A: When to bypass Django's request handling
- 24:27Q&A: Using signed cookies from JavaScript
- 25:10Q&A: Header case sensitivity in Django
- 26:37Q&A: Django vs other Python web frameworks
- 29:06Closing remarks and acknowledgments
related talks
26mUsing Django as a Micro-Framework: Hacking on the HTTP handlers..
31mReinventing Django for the Real-Time Web
37mFrog and Toad Learn About Django Security
46mIntroducing Django REST framework
25mHunting for Treasure in Django
27mBuilding a REST API with Django & Django REST Framework
26mDjango, REST and OpenAPI - a gentle introduction
18mFrom WSGI to ASGI - Django 3.0
