diff options
author | Guido van Rossum <guido@python.org> | 2000-05-08 17:31:04 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-05-08 17:31:04 (GMT) |
commit | aad6761ccea28e0a0da6761570b18adc72e01c37 (patch) | |
tree | 731b55d5648f08e1bc755bcace1f836413cd8aae /Lib/dos-8x3/cgihttps.py | |
parent | 0b095bc0929fb43157019c50e3e680a29ec94a65 (diff) | |
download | cpython-aad6761ccea28e0a0da6761570b18adc72e01c37.zip cpython-aad6761ccea28e0a0da6761570b18adc72e01c37.tar.gz cpython-aad6761ccea28e0a0da6761570b18adc72e01c37.tar.bz2 |
The usual...
Diffstat (limited to 'Lib/dos-8x3/cgihttps.py')
-rwxr-xr-x | Lib/dos-8x3/cgihttps.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Lib/dos-8x3/cgihttps.py b/Lib/dos-8x3/cgihttps.py index 806ef57..fa30cbd 100755 --- a/Lib/dos-8x3/cgihttps.py +++ b/Lib/dos-8x3/cgihttps.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. + """ @@ -10,15 +13,18 @@ __version__ = "0.3" import os -import sys -import time -import socket import string import urllib import BaseHTTPServer import SimpleHTTPServer +try: + os.fork +except AttributeError: + raise SystemError, __name__ + " requires os.fork()" + + class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): """Complete HTTP server with GET, HEAD and POST commands. @@ -150,6 +156,9 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): ua = self.headers.getheader('user-agent') if ua: env['HTTP_USER_AGENT'] = ua + co = filter(None, self.headers.getheaders('cookie')) + if co: + env['HTTP_COOKIE'] = string.join(co, ', ') # XXX Other HTTP_* headers decoded_query = string.replace(query, '+', ' ') try: @@ -177,7 +186,7 @@ def nobody_uid(): import pwd try: nobody = pwd.getpwnam('nobody')[2] - except pwd.error: + except KeyError: nobody = 1 + max(map(lambda x: x[2], pwd.getpwall())) return nobody |