| 63 | self.end_headers() |
| 64 | |
| 65 | def do_GET(self) -> None: |
| 66 | if self.path[1:].rstrip() == '': |
| 67 | content = b'ok\n\n' |
| 68 | elif self.path[1:].rstrip() == 'anchor.html': |
| 69 | doc = '<!DOCTYPE html><html><body><a id="found"></a></body></html>' |
| 70 | content = doc.encode('utf-8') |
| 71 | else: |
| 72 | content = b'' |
| 73 | |
| 74 | if content: |
| 75 | self.send_response(200, 'OK') |
| 76 | self.send_header('Content-Length', str(len(content))) |
| 77 | self.end_headers() |
| 78 | self.wfile.write(content) |
| 79 | else: |
| 80 | self.send_response(404, 'Not Found') |
| 81 | self.send_header('Content-Length', '0') |
| 82 | self.end_headers() |
| 83 | |
| 84 | |
| 85 | class ConnectionMeasurement: |