| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
added test script and expected output file as well
this closes patch 103297.
__all__ attributes will be added to other modules without first submitting
a patch, just adding the necessary line to the test script to verify
more-or-less correct implementation.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
for SocketServer.py (inherited by TCPServer)
Luke wrote:
The socketserver code, with a little bit of tweaking, can be made
sufficiently general to service "requests" of any kind, not just by sockets.
The BaseServer class was created, for example, to poll a table in a MYSQL
database every 2 seconds. each entry in the table can be allocated a
Handler which deals with the entry.
With this patch, using BaseServer and ThreadedServer classes, the creation
of the server that reads and handles MySQL table entries instead of a
socket was utterly trivial: about 50 lines of python code.
You may consider this code to be utterly useless [why would anyone else
want to do anything like this???] - you are entitled to your opinion. if you
think so, then think of this: have you considered how to cleanly add SSL to
the TCPSocketServer? What about using shared memory as the
communications mechanism for a server, instead of sockets? What about
communication using files?
The SocketServer code is extremely good every useful. it's just that as it
stands, it is tied to sockets, which is not as useful.
I heartily approve of this idea.
|
| |
|
|
|
|
|
|
|
|
|
| |
and wfile class variables (that the instance can also override).
Change the default for rfile to buffered, because that seems to make a
big difference in performance on some platforms.
An anti-patch is needed to revert the effect in CGIHTTPServer.py which
I'll check in momentarily.
|
|
|
|
| |
server_bind() method calls setsockopt(SOL_SOCKET, SO_REUSEADDR, 1).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
"""
Here's a patch for the ForkingMixIn which will prevent the server from
forking itself into the ground. Note: I've tested a very similar patch
(subclassed ForkingMixIn) but not actually tested this one. As you might
surmise, this was done out of necessity...
If the maximum number of children are already running, block while waiting
for a child to exit.
"""
(I added that last sentence as a comment to the code --GvR.)
|
|
|
|
|
| |
may raise an exception (when there are no children). Reported by
Andy Dustman.
|
|
|
|
|
| |
and suggests putting a try/except around the get_request() call in
handle_request(). (All in class TCPServer.)
|
|
|
|
| |
Here's the correct patch!
|
|
|
|
|
|
|
|
|
| |
I noticed while watching (with lsof) my forking SocketServer app running
that I would get multiple processes listening to the socket. For the most
part, this doesn't hurt things, but if you terminate the server, this can
prevent it from restarting because it cannot bind to the port due to any
running children which also have the socket open. The following one-liner
fixes this.
|
|
|
|
|
|
|
|
| |
threaded versions of Unix Server classes, using the
ThreadingMixIn class:
ThreadingUnixStreamServer
ThreadingUnixDatagramServer
|
|
|
|
| |
Noted by Stefan Witzel.
|
|
|
|
| |
credit for complaining about this and for testing these changes.
|
|
|
|
| |
mostly for jpython.
|
| |
|
|
|
|
|
| |
first. Don't store the traceback as a local variable, to avoid
circular references.
|
| |
|
|
|
|
| |
CGIHTTPServer.py when used with the POST command.
|
| |
|
| |
|
|
|