Referrer key missing form os.environ dictionary?

John Gordon gordon at panix.com
Wed Sep 25 10:18:24 EDT 2013


In <l1ulsv$4mv$1 at dont-email.me> =?UTF-8?B?zp3Or866zr/Pgg==?= <nikos.gr33k at gmail.com> writes:

> referrer = os.environ['HTTP_REFERER']

> Do i miss something? its a suprise to me that the environ dictioanry has 
> almost anythign but a referrer key.

HTTP_REFERER is used to indicate the URL containing the link that led
the user to the current URL.  So for example if the user is viewing
foo.html and then clicks a link on that page which leads to bar.html, the
HTTP_REFERER for that request would be foo.html.

However, if the user did not arrive from another page, then HTTP_REFERER
will be missing.  This happens when the user types the web address directly
into their browser, or clicks on a bookmark, or many other ways.

Also, obviously, it's up to the browser to truthfully report HTTP_REFERER;
the server itself has no idea what page you were on previously.  What
browser are you using?

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list