summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-03-09 03:15:56 (GMT)
committerCollin Winter <collinw@gmail.com>2007-03-09 03:15:56 (GMT)
commit83b2bf6d9a7f3fe774bdce69b5d9a4202bd7889c (patch)
treec701deda267e05716711060d87a5492d038d1104
parenta30fcb4dae51705f182383a6ad5f3fb86a80f9fb (diff)
downloadcpython-83b2bf6d9a7f3fe774bdce69b5d9a4202bd7889c.zip
cpython-83b2bf6d9a7f3fe774bdce69b5d9a4202bd7889c.tar.gz
cpython-83b2bf6d9a7f3fe774bdce69b5d9a4202bd7889c.tar.bz2
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
-rw-r--r--Lib/CGIHTTPServer.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/CGIHTTPServer.py b/Lib/CGIHTTPServer.py
index 88613ad..06278df 100644
--- a/Lib/CGIHTTPServer.py
+++ b/Lib/CGIHTTPServer.py
@@ -197,6 +197,9 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
length = self.headers.getheader('content-length')
if length:
env['CONTENT_LENGTH'] = length
+ referer = self.headers.getheader('referer')
+ if referer:
+ env['HTTP_REFERER'] = referer
accept = []
for line in self.headers.getallmatchingheaders('accept'):
if line[:1] in "\t\n\r ":
@@ -214,7 +217,7 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
# Since we're setting the env in the parent, provide empty
# values to override previously set values
for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH',
- 'HTTP_USER_AGENT', 'HTTP_COOKIE'):
+ 'HTTP_USER_AGENT', 'HTTP_COOKIE', 'HTTP_REFERER'):
env.setdefault(k, "")
os.environ.update(env)