470,604 Members | 2,020 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,604 developers. It's quick & easy.

CGIHTTPServer threading problems

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,BaseHT TPServer.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?
Mar 31 '06 #1
1 2285

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,BaseHT TPServer.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).

Mar 31 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Andy Worms | last post: by
3 posts views Thread by vincent wehren | last post: by
3 posts views Thread by William D. Gill | last post: by
6 posts views Thread by pxlpluker | last post: by
1 post views Thread by Sullivan | last post: by
1 post views Thread by Thomas Guettler | last post: by
2 posts views Thread by Johan Kohler | last post: by
1 post views Thread by Bill Oldroyd | last post: by
1 post views Thread by mpc | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.