Kaydet (Commit) e2f18377 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

SF bug #430160: CGIHTTPServer.py POST bug using IE

Minor improvement to previous bugfix.
Eating the remaining characters would lead to an endless loop
without a termination test.
üst be2528d8
...@@ -202,7 +202,8 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): ...@@ -202,7 +202,8 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
pid, sts = os.waitpid(pid, 0) pid, sts = os.waitpid(pid, 0)
# throw away additional data [see bug #427345] # throw away additional data [see bug #427345]
while select.select([self.rfile], [], [], 0)[0]: while select.select([self.rfile], [], [], 0)[0]:
waste = self.rfile.read(1) if not self.rfile.read(1):
break
if sts: if sts:
self.log_error("CGI script exit status %#x", sts) self.log_error("CGI script exit status %#x", sts)
return return
...@@ -250,7 +251,8 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): ...@@ -250,7 +251,8 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
fi.write(data) fi.write(data)
# throw away additional data [see bug #427345] # throw away additional data [see bug #427345]
while select.select([self.rfile._sock], [], [], 0)[0]: while select.select([self.rfile._sock], [], [], 0)[0]:
waste = self.rfile._sock.recv(1) if not self.rfile._sock.recv(1):
break
fi.close() fi.close()
shutil.copyfileobj(fo, self.wfile) shutil.copyfileobj(fo, self.wfile)
if self.have_popen3: if self.have_popen3:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment