MCPcopy
hub / github.com/tornadoweb/tornado / handle_request

Method handle_request

tornado/test/httpserver_test.py:1516–1531  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

1514 # delegate interface, and writes its response via request.write
1515 # instead of request.connection.write_headers.
1516 def handle_request(request):
1517 self.http1 = request.version.startswith("HTTP/1.")
1518 if not self.http1:
1519 # This test will be skipped if we're using HTTP/2,
1520 # so just close it out cleanly using the modern interface.
1521 request.connection.write_headers(
1522 ResponseStartLine("", 200, "OK"), HTTPHeaders()
1523 )
1524 request.connection.finish()
1525 return
1526 message = b"Hello world"
1527 request.connection.write(
1528 utf8("HTTP/1.1 200 OK\r\n" "Content-Length: %d\r\n\r\n" % len(message))
1529 )
1530 request.connection.write(message)
1531 request.connection.finish()
1532
1533 return handle_request
1534

Callers

nothing calls this directly

Calls 6

ResponseStartLineClass · 0.90
HTTPHeadersClass · 0.90
utf8Function · 0.90
write_headersMethod · 0.45
finishMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected