Opened 15 years ago

Closed 15 years ago

#13018 closed (wontfix)

Raw request data should be exposed via request object.

Reported by: Damon Owned by: nobody
Component: HTTP handling Version: 1.1
Severity: Keywords: raw request data
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I recently had the need to proxy some requests from some clients to 3rd party servers. Trying to avoid skewing stats I tried to replicate the clients headers when making the new requests to the 3rd party. Not wanting to loop through all items in request.META I looked for a Django property that exposed the raw request data. There isn't one.

I've checked the source of various Django web proxies and they either don't try to replicate headers at all or they end up with the approach I ultimately had to take - looping over request.META for "HTTP_" prefixed keys, changing them to title case and replacing underscores with hyphens.

Django needs to expose raw request data.

Change History (2)

comment:1 by Karen Tracey, 15 years ago

milestone: 1.2

Please don't put new feature requests in the milestone for a feature-frozen release.

comment:2 by James Bennett, 15 years ago

Resolution: wontfix
Status: newclosed

The raw request data is exposed; in the WSGI adapter it's on the environ property of WSGIRequest (this is the original, unmodified WSGI environ passed to Django), and on mod_python it's the _req property of ModPythonRequest (this is the original mod_python request object passed to Django).

At the moment I don't think these need to be documented, though, because they're internal implementation details of the specific gateway protocols and so don't constitute a consistent Django-level API (since they vary according to the gateway in use), and are easy enough to find if you just go look at the code Django implements to handle those protocols.

Note: See TracTickets for help on using tickets.
Back to Top