From: Ben Darnell Date: Mon, 27 Oct 2014 02:15:31 +0000 (-0400) Subject: Remove example of the legacy HTTPServer callback interface. X-Git-Tag: v4.1.0b1~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26cb9b3fa67ef3282414a86743ee2e16c81913c3;p=thirdparty%2Ftornado.git Remove example of the legacy HTTPServer callback interface. Even before the HTTPServerConnectionDelegate interface replaced it, direct use of this callback interface should have been rare. This untested example was incorrect when first written and once fixed only worked on python 2. --- diff --git a/tornado/httpserver.py b/tornado/httpserver.py index d4c990caa..47c747263 100644 --- a/tornado/httpserver.py +++ b/tornado/httpserver.py @@ -42,30 +42,10 @@ from tornado.tcpserver import TCPServer class HTTPServer(TCPServer, httputil.HTTPServerConnectionDelegate): r"""A non-blocking, single-threaded HTTP server. - A server is defined by either a request callback that takes a - `.HTTPServerRequest` as an argument or a `.HTTPServerConnectionDelegate` - instance. - - A simple example server that echoes back the URI you requested:: - - import tornado.httpserver - import tornado.ioloop - from tornado import httputil - - def handle_request(request): - message = "You requested %s\n" % request.uri - request.connection.write_headers( - httputil.ResponseStartLine('HTTP/1.1', 200, 'OK'), - httputil.HTTPHeaders({"Content-Length": str(len(message))})) - request.connection.write(message) - request.connection.finish() - - http_server = tornado.httpserver.HTTPServer(handle_request) - http_server.listen(8888) - tornado.ioloop.IOLoop.instance().start() - - Applications should use the methods of `.HTTPConnection` to write - their response. + A server is defined by a subclass of `.HTTPServerConnectionDelegate`, + or, for backwards compatibility, a callback that takes an + `.HTTPServerRequest` as an argument. The delegate is usually a + `tornado.web.Application`. `HTTPServer` supports keep-alive connections by default (automatically for HTTP/1.1, or for HTTP/1.0 when the client