Re: Best way to change request's HTTP Referer?
- From:
- Zach Williams
- Date:
- 2011-05-27 @ 01:26
So I'm pretty sure that this line applies to me in the
documentation<http://flask.pocoo.org/docs/api/#flask.Request>
:
If you want to replace the request object used you can subclass this and set
> *request_class* to your subclass.
I've been reading through the source code of Werkzeug and Flask, but I'm
still unsure of the best way to go about this. It seems like
the `werkzeug.wrappers.CommonRequestDescriptorsMixin` sets the request's
HTTP Referer with the `environ_property` class?
Should I be initializing an `environ_property` class with a dict like:
{'HTTP_REFERER': 'http://whatever-I-want-here'} and then passing that off to
my subclass?
Thanks.
Zach
On Mon, May 23, 2011 at 5:38 PM, Zach Williams <hey@zachwill.com> wrote:
> What would be the best way to change an incoming request's Referer string?
> I've been playing around for the past hour trying to figure this out, but
> haven't found a simple way yet (I'm guessing I might have to import
> Werkzeug's Request object, though).
>
> For some context, I'm wanting to change the HTTP Referer of an incoming
> request before redirecting it to another page.
>
> Thanks.
>
> Zach
>