(request)
| 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 |
nothing calls this directly
no test coverage detected