CGIHTTPServer threading problems

I

infidel

Alvin said:
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).
 
A

Alvin A. Delagon

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,201
Latest member
KourtneyBe

Latest Threads

Top