Code

Opened 4 years ago

Closed 4 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: UI/UX:

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.

Attachments (0)

Change History (2)

comment:1 Changed 4 years ago by kmtracey

  • milestone 1.2 deleted
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

comment:2 Changed 4 years ago by ubernostrum

  • Resolution set to wontfix
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.