Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 01fc65d

Browse files
committed
From: [email protected] (Conrad Huang %CGL)
To: [email protected] Date: 13 May 98 18:33:11 GMT I think I found a bug in CGIHTTPServer.py. (Does anyone care? :-) I was trying to use it as the web server for uploading files. Python CGI scripts (using the CGI module) that worked for other servers (e.g., Netscape Enterprise server) hang when run from CGIHTTPServer. The problem is that the content type parameters, in particular the boundary parameter, were not passed through to the CGI scripts, thus making the MIME parsing code choke. My simple-minded fix is: % diff CGIHTTPServer.py /usr/local/lib/python1.5/CGIHTTPServer.py 137,140c136 < if self.headers.typeheader is None: < env['CONTENT_TYPE'] = self.headers.type < else: < env['CONTENT_TYPE'] = self.headers.typeheader --- > env['CONTENT_TYPE'] = self.headers.type Conrad
1 parent 1f05cb0 commit 01fc65d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/CGIHTTPServer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ def run_cgi(self):
133133
# AUTH_TYPE
134134
# REMOTE_USER
135135
# REMOTE_IDENT
136-
env['CONTENT_TYPE'] = self.headers.type
136+
if self.headers.typeheader is None:
137+
env['CONTENT_TYPE'] = self.headers.type
138+
else:
139+
env['CONTENT_TYPE'] = self.headers.typeheader
137140
length = self.headers.getheader('content-length')
138141
if length:
139142
env['CONTENT_LENGTH'] = length

0 commit comments

Comments
 (0)