Code

Fix thread safety with stdin in roundup-server
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Tue, 2 Feb 2010 05:00:42 +0000 (05:00 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Tue, 2 Feb 2010 05:00:42 +0000 (05:00 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4448 57a73879-2fb5-44c3-a270-3262357dd7e2

CHANGES.txt
doc/acknowledgements.txt
roundup/cgi/client.py
roundup/scripts/roundup_server.py

index 7161378a5cbb50cb54d4d3c6fc043cefd10a9ed0..96fedf3f2a5f65e860e9e0dd13d31630b4e10fbe 100644 (file)
@@ -29,6 +29,8 @@ Fixes:
   issue2550632
 - Allow value to be specified to multilink form element templating, fixes
   issue2550613, thanks David Wolever
+- Fix thread safety with stdin in roundup-server, fixes issue2550596
+  (thanks Werner Hunger)
 
 
 2009-12-21 1.4.11 (r4413)
index 8ab905801c188fc685d01531397d59f3a0e167ed..13793dc70879f3d9273fcde73b467b8c8fd477eb 100644 (file)
@@ -58,6 +58,7 @@ Tobias Herp,
 Uwe Hoffmann,
 Alex Holkner,
 Tobias Hunger,
+Werner Hunger,
 Simon Hyde,
 Paul Jimenez,
 Christophe Kalt,
index b66b39b6e6208db1bfbd89c3813c0c8e3d80eea1..3b1023806a5bd4b20c7c3040c0cb6bd8378a7406 100644 (file)
@@ -300,7 +300,7 @@ class Client:
 
         # see if we need to re-parse the environment for the form (eg Zope)
         if form is None:
-            self.form = cgi.FieldStorage(environ=env)
+            self.form = cgi.FieldStorage(fp=request.rfile, environ=env)
         else:
             self.form = form
 
index 266edb9312c588c6c06e6b0d4489726a380f8677..12a2d0083cbb3e81bba61f2c56a2b9e2b685ac60 100644 (file)
@@ -188,8 +188,6 @@ class RoundupRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
         """ Execute the CGI command. Wrap an innner call in an error
             handler so all errors can be caught.
         """
-        save_stdin = sys.stdin
-        sys.stdin = self.rfile
         try:
             self.inner_run_cgi()
         except client.NotFound:
@@ -226,7 +224,6 @@ class RoundupRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
                     # out to the logfile
                     print 'EXCEPTION AT', ts
                     traceback.print_exc()
-        sys.stdin = save_stdin
 
     do_GET = do_POST = do_HEAD = run_cgi