Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a65b2e28
Commit
a65b2e28
authored
Mar 09, 2007
by
Collin Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
parent
cf8e817e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
Lib/CGIHTTPServer.py
Lib/CGIHTTPServer.py
+4
-1
No files found.
Lib/CGIHTTPServer.py
View file @
a65b2e28
...
@@ -197,6 +197,9 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
...
@@ -197,6 +197,9 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
length
=
self
.
headers
.
getheader
(
'content-length'
)
length
=
self
.
headers
.
getheader
(
'content-length'
)
if
length
:
if
length
:
env
[
'CONTENT_LENGTH'
]
=
length
env
[
'CONTENT_LENGTH'
]
=
length
referer
=
self
.
headers
.
getheader
(
'referer'
)
if
referer
:
env
[
'HTTP_REFERER'
]
=
referer
accept
=
[]
accept
=
[]
for
line
in
self
.
headers
.
getallmatchingheaders
(
'accept'
):
for
line
in
self
.
headers
.
getallmatchingheaders
(
'accept'
):
if
line
[:
1
]
in
"
\
t
\
n
\
r
"
:
if
line
[:
1
]
in
"
\
t
\
n
\
r
"
:
...
@@ -214,7 +217,7 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
...
@@ -214,7 +217,7 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
# Since we're setting the env in the parent, provide empty
# Since we're setting the env in the parent, provide empty
# values to override previously set values
# values to override previously set values
for
k
in
(
'QUERY_STRING'
,
'REMOTE_HOST'
,
'CONTENT_LENGTH'
,
for
k
in
(
'QUERY_STRING'
,
'REMOTE_HOST'
,
'CONTENT_LENGTH'
,
'HTTP_USER_AGENT'
,
'HTTP_COOKIE'
):
'HTTP_USER_AGENT'
,
'HTTP_COOKIE'
,
'HTTP_REFERER'
):
env
.
setdefault
(
k
,
""
)
env
.
setdefault
(
k
,
""
)
os
.
environ
.
update
(
env
)
os
.
environ
.
update
(
env
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment