Re: CGIHTTPServer threading problems




Alvin A. Delagon wrote:
I'm a simple python webserver based on CGIHTTPServer module:

import CGIHTTPServer
import BaseHTTPServer
import SocketServer
import sys
import SQL,network
from config import *

class
ThreadingServer(SocketServer.ThreadingMixIn,BaseHTTPServer.HTTPServer):
pass

cfg = params()
print "XBOX Server started on port %s. Press Ctrl+C to kill Server" %
cfg.port
server =
ThreadingServer((cfg.name,cfg.port),CGIHTTPServer.CGIHTTPRequestHandler)
try:
while 1:
sys.stdout.flush()
server.handle_request()
except KeyboardInterrupt:
print "Server killed"


The my cgi scripts are stored in the cgi-bin folder. One cgi script in
particular implements multi-threading and is supposed to be asynchronous
but it's not working. The browser that requests on the cgi script tends
to wait until the cgi script is done. I checked multi-threaded cgi
script but I'm 100% percent sure that it has no problem since it worked
as a mod_python script before. Anyone came across with this problem?

CGI doesn't run asynchronously. All you've done with a multithreaded
CGI server is have each CGI script run on a separate thread. But that
doesn't change the fact that a browser is going to sit there and wait
as the CGI script runs to completion (which is how the server knows
it's done).

.



Relevant Pages

  • Re: IIS Config Help - This is a hard one - Migration from Linux to Win2K
    ... Migrate Apache Settings and Configure IIS in a UNIX-to-Windows ... > I am migrating a website from a Linux server to a Win2k server. ... > to a CGI script. ... > pop-up the binary data in a new browser page. ...
    (microsoft.public.inetserver.iis.security)
  • Re: How to automatically return from a CGI script?
    ... IF you invoke a cgi script that does something server side, ... sends no data whatsoever, the browser simply stays where it is on the ...
    (comp.lang.php)
  • Re: Ho can I get output of a command in web page?
    ... Do I need to write a cgi script for this, or can a simple SSI be made to work? ... I did think of an automated procedure which was less inclined to error, which was a startup script that wrote the warning about being on the wrong server if it was not the main server. ... I was initially dismissing that as too much work, ... I've not tried the bit to write the data based on the hostname, but the following puts the hostname into an environment variable and prints it. ...
    (uk.net.web.authoring)
  • Re: Concern for storage of payment gateway key
    ... > another server, the passphrase to decrypt the file, and the login access to ... I think your confusion is due to an error in what the CGI script requires. ... The authentication server needs read access to the file ...
    (comp.security.unix)
  • Re: Quick CGI question (specific to the CGI package)
    ... the video file content has the cgi script as the file name. ... The browser thinks the file is called "script.pl". ... The mime.types file on the server has no ... served directly (as opposed to through a CGI script) by the server. ...
    (comp.lang.perl.misc)