summaryrefslogtreecommitdiff
path: root/Lib/SocketServer.py
AgeCommit message (Collapse)AuthorLines
2002-04-18backport gvanrossum's patch:Anthony Baxter-1/+1
SF bug #543318 (Frank J. Tobin). In DatagramRequestHandler.setup(), the wfile initialization should be StringIO.StringIO(), not StringIO.StringIO(slf.packet). Bugfix candidate (all the way back to Python 1.5.2 :-). Original patches were: python/dist/src/Lib/SocketServer.py:1.31
2001-10-23Apply the first chunk of the second patch from SF bug #471720:Guido van Rossum-3/+11
ThreadingMixIn/TCPServer forgets close (Max Neunhöffer). This ensures that handle_error() and close_request() are called when an error occurs in the thread. (I am not applying the second chunk of the patch, which moved the finish() call into the finally clause in BaseRequestHandler's __init__ method; that would be a semantic change that I cannot accept at this point - the data would be sent even if the handler raised an exception.)
2001-10-18SF bug #471720: ThreadingMixIn/TCPServer forgets closeGuido van Rossum-1/+6
Solved with a helper method that calls finish_request() and then close_request(). The code is by Max Neunhöffer.
2001-10-03remove empty __del__ method from BaseRequestHandler to avoid cyclic garbageSkip Montanaro-3/+0
loss for no reason.
2001-07-24Patch #401196: Use getaddrinfo and AF_INET6 in TCP servers and clients.Martin v. Löwis-1/+1
2001-07-10IMPORTANT FIX: This should definitely go into the 2.1.1 release!!!Guido van Rossum-6/+15
Fix various serious problems: - The ThreadingTCPServer class and its derived classes were completely broken because the main thread would close the request before the handler thread had time to look at it. This was introduced by Ping's close_request() patch. The fix moves the close_request() calls to after the handler has run to completion in the BaseServer class and the ForkingMixIn class; when using the ThreadingMixIn, closing the request is the handler's responsibility. - The ForkingUDPServer class has always been been broken because the socket was closed in the child before calling the handler. I fixed this by simply not calling server_close() in the child at all. - I cannot get the UnixDatagramServer class to work at all. The recvfrom() call doesn't return a meaningful client address. I added a comment to this effect. Maybe it works on other Unix versions. - The __all__ variable was missing ThreadingMixIn and ForkingMixIn. - Bumped __version__ to "0.4". - Added a note about the test suite (to be checked in shortly).
2001-04-11Add a close_request method to the BaseServer so that the TCPServer classKa-Ping Yee-0/+14
can close the request connection when it's done handling it.
2001-01-20added __all__ lists to a number of Python modulesSkip Montanaro-0/+7
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.
2001-01-19Bump __version__; add authorship note for the BaseServer patch.Guido van Rossum-1/+2
2001-01-19SF Patch #102980, by Luke Kenneth Casson Leighton: BaseServer classGuido van Rossum-51/+139
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.
2000-12-13Changing allow_reuse_address's default value, and documenting it.Moshe Zadka-1/+1
2000-09-01In class StreamRequestHandler, make the default buffering for rfileGuido van Rossum-2/+12
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.
2000-05-09Add class variable allow_reuse_address in TCPServer -- if nonzero, theGuido van Rossum-0/+5
server_bind() method calls setsockopt(SOL_SOCKET, SO_REUSEADDR, 1).
1999-10-12update to use threading module instead of thread.Jeremy Hylton-4/+4
1999-07-28Another patch from Andy Dustman:Guido van Rossum-1/+8
""" 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.)
1999-06-17In collect_children(), put a try-except around os.waitpid() because itGuido van Rossum-1/+4
may raise an exception (when there are no children). Reported by Andy Dustman.
1999-06-15Laurence Tratt notes that the accept() call in get_request() can fail,Guido van Rossum-1/+4
and suggests putting a try/except around the get_request() call in handle_request(). (All in class TCPServer.)
1999-06-01Andy Dustman notes that I patched the close() call in the wrong place.Guido van Rossum-1/+1
Here's the correct patch!
1999-05-21Andy Dustman writes:Guido van Rossum-0/+1
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.
1998-11-30Patch by Jeff Bauer: a minor change to declare two newGuido van Rossum-12/+11
threaded versions of Unix Server classes, using the ThreadingMixIn class: ThreadingUnixStreamServer ThreadingUnixDatagramServer
1998-11-16Fix typo in docstring: client_request should be client_address.Guido van Rossum-1/+1
Noted by Stefan Witzel.
1998-06-16Fixed the UDP server -- this never worked. Ray Loyzaga deservesGuido van Rossum-2/+7
credit for complaining about this and for testing these changes.
1998-04-03Explicitly close rfile and wfile in StreamRequestHandler.finish() --Guido van Rossum-0/+2
mostly for jpython.
1998-03-26Mass check-in after untabifying all files that need it.Guido van Rossum-128/+128
1997-09-29No longer need to be very careful with saving the exception stateGuido van Rossum-2/+1
first. Don't store the traceback as a local variable, to avoid circular references.
1997-07-16Fix bug found by kjpylint; change doc string to avoid "(" in column 1.Guido van Rossum-5/+5
1996-10-23Make self.rfile unbuffered (self.wfile already is). This should fixGuido van Rossum-1/+1
CGIHTTPServer.py when used with the POST command.
1996-02-14Changed makefile() args from r/w to rb/wb, for non-unix compatability.Jack Jansen-2/+2
1996-01-25correct retrieving return value of os.waitpid()Guido van Rossum-1/+1
1995-08-04Initial revisionGuido van Rossum-0/+413