473,396 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 2419

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andy Worms | last post by:
I'm using CGIHTTPServer to try some scripts, apparently as a first step of building a real server. The CGIHTTPServer source code has a comment that warns of potential security problems: SECURITY...
3
by: vincent wehren | last post by:
Hi, as a small capabilities demo I coded the piece below to show how to use Python for cgi'ing on localhost and it more or less does the trick :-). However, I when I freeze it with py2exe,...
3
by: William D. Gill | last post by:
I use a notebook (win 98) because of its portability. Unfortunately it is very slow. When I try to develop and test python cgi scripts I use Xitami as a local server, but with python, Xitami, and...
6
by: pxlpluker | last post by:
i was looking at twisted but it appears to be WAY beyond my megar skills at this point. so i think CGIHTTPServer will fit my needs if it is pretty stable. I have a small python cgi that i was...
1
by: Sullivan | last post by:
When I run a CGI script (Python) with Python's CGIHTTPServer, it should run with the UID of the user 'nobody' (as the documentation says). But if I let the CGI script e.g. create a file, it...
1
by: Thomas Guettler | last post by:
Hi, The CGIHTTPServer returns self.send_response(200, "Script output follows") before it starts the cgi process. This means you cannot set the status header to 302 for a redirect.
2
by: Johan Kohler | last post by:
Hi, I'm using CGIHTTPServer (via its test() method) to test some CGI on my Windoze 98 box. I find that the execution is very slow. Is there anything I can do to make sure I'm getting the best...
1
by: Bill Oldroyd | last post by:
I cannot get a simple CGI-script to work with this combination : Redhat 9 Linux Both Python 2.41. and ActiveState Python 2.4.1 either as an Apache 2 cgi-script or using CGIHTTPServer. The...
1
by: mpc | last post by:
hello, how does one run a PHP page with a python webserver? Lets say i have a simple python web server running /path/webserver.py #!/usr/bin/env python from BaseHTTPServer import HTTPServer...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.