Serve a GET request.
(self, send_body=True)
| 91 | server_version = "StatsHTTPS/1.0" |
| 92 | |
| 93 | def do_GET(self, send_body=True): |
| 94 | """Serve a GET request.""" |
| 95 | sock = self.rfile.raw._sock |
| 96 | context = sock.context |
| 97 | stats = { |
| 98 | 'session_cache': context.session_stats(), |
| 99 | 'cipher': sock.cipher(), |
| 100 | 'compression': sock.compression(), |
| 101 | } |
| 102 | body = pprint.pformat(stats) |
| 103 | body = body.encode('utf-8') |
| 104 | self.send_response(200) |
| 105 | self.send_header("Content-type", "text/plain; charset=utf-8") |
| 106 | self.send_header("Content-Length", str(len(body))) |
| 107 | self.end_headers() |
| 108 | if send_body: |
| 109 | self.wfile.write(body) |
| 110 | |
| 111 | def do_HEAD(self): |
| 112 | """Serve a HEAD request.""" |
no test coverage detected