summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1999-10-16 02:07:50 (GMT)
committerFred Drake <fdrake@acm.org>1999-10-16 02:07:50 (GMT)
commit40e84db0f4ca06cfd40f6eebe2f9907797c8a67b (patch)
treee2c7df2419c9d8b4f6b7dca9afa57a220e027976
parent226ae6ca122f814dabdc40178c7b9656caf729c2 (diff)
downloadcpython-40e84db0f4ca06cfd40f6eebe2f9907797c8a67b.zip
cpython-40e84db0f4ca06cfd40f6eebe2f9907797c8a67b.tar.gz
cpython-40e84db0f4ca06cfd40f6eebe2f9907797c8a67b.tar.bz2
Based on comments from Paul Prescod:
If os.fork() doesn't exist, raise SystemError with an explanation at the top of the module. Added a note to the module docstring.
-rw-r--r--Lib/CGIHTTPServer.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/CGIHTTPServer.py b/Lib/CGIHTTPServer.py
index d5ec7b0..dc17392 100644
--- a/Lib/CGIHTTPServer.py
+++ b/Lib/CGIHTTPServer.py
@@ -3,6 +3,9 @@
This module builds on SimpleHTTPServer by implementing GET and POST
requests to cgi-bin scripts.
+If the os.fork() function is not present, this module will not work;
+SystemError will be raised instead.
+
"""
@@ -16,6 +19,12 @@ import BaseHTTPServer
import SimpleHTTPServer
+try:
+ os.fork
+except NameError:
+ raise SystemError, __name__ + " requires os.fork()"
+
+
class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""Complete HTTP server with GET, HEAD and POST commands.
@@ -147,9 +156,9 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
ua = self.headers.getheader('user-agent')
if ua:
env['HTTP_USER_AGENT'] = ua
- co = self.headers.getheader('cookie')
+ co = filter(None, self.headers.getheaders('cookie'))
if co:
- env['HTTP_COOKIE'] = co
+ env['HTTP_COOKIE'] = string.join(co, ', ')
# XXX Other HTTP_* headers
decoded_query = string.replace(query, '+', ' ')
try: