Title: HTTPSever.handle_request not respecting timeout as documented between first and second request · Issue #102156 · python/cpython · GitHub
Open Graph Title: HTTPSever.handle_request not respecting timeout as documented between first and second request · Issue #102156 · python/cpython
X Title: HTTPSever.handle_request not respecting timeout as documented between first and second request · Issue #102156 · python/cpython
Description: Bug report The HTTPServer times out as expected before receiving the first request and after receiving the second request. However, HTTPServer doesn't timeout as expected between the first and second request, blocking until the second re...
Open Graph Description: Bug report The HTTPServer times out as expected before receiving the first request and after receiving the second request. However, HTTPServer doesn't timeout as expected between the first and seco...
X Description: Bug report The HTTPServer times out as expected before receiving the first request and after receiving the second request. However, HTTPServer doesn't timeout as expected between the first and ...
Opengraph URL: https://github.com/python/cpython/issues/102156
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"HTTPSever.handle_request not respecting timeout as documented between first and second request","articleBody":"# Bug report\r\n\r\nThe HTTPServer times out as expected before receiving the first request and after receiving the second request. However, HTTPServer doesn't timeout as expected between the first and second request, blocking until the second request is received by HTTPServer.\r\n\r\n# Your environment\r\n\r\n- CPython versions tested on: 3.11.1\r\n- Operating system and architecture: Windows 11 22H2 x64\r\n\r\n# Example code demonstrating the issue\r\n```python\r\nfrom http.server import BaseHTTPRequestHandler, HTTPServer\r\n\r\n\r\nclass HelloWorldHTTPRequestHandler(BaseHTTPRequestHandler):\r\n def do_GET(self):\r\n self.send_response(200)\r\n self.send_header(\"Content-Type\", \"text/plain\")\r\n self.end_headers()\r\n self.wfile.write(\"Hello World!\".encode(\"utf8\"))\r\n\r\n\r\nif __name__ == \"__main__\":\r\n httpd = HTTPServer((\"localhost\", 65012), HelloWorldHTTPRequestHandler)\r\n httpd.timeout = 1\r\n\r\n while True:\r\n try:\r\n print(\"handle_request\")\r\n httpd.handle_request()\r\n\r\n except KeyboardInterrupt:\r\n break\r\n\r\n```\r\n\r\n# Example code output\r\n```\r\nhandle_request\r\nhandle_request\r\nhandle_request\r\nhandle_request\r\n127.0.0.1 - - [22/Feb/2023 14:49:14] \"GET / HTTP/1.1\" 200 -\r\nhandle_request\r\n127.0.0.1 - - [22/Feb/2023 14:49:29] \"GET / HTTP/1.1\" 200 -\r\nhandle_request\r\nhandle_request\r\nhandle_request\r\nhandle_request\r\nhandle_request\r\nhandle_request\r\nhandle_request\r\nhandle_request\r\nhandle_request\r\nKeyboardInterrupt\r\n```\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-137806\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/eXhumer","@type":"Person","name":"eXhumer"},"datePublished":"2023-02-22T21:58:57.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/102156/cpython/issues/102156"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:dfe10338-77a1-7c15-acaa-c9c76b9c21a3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC34:275F42:26F4658:34BBE98:696ADBE0 |
| html-safe-nonce | 974cbd14864fea2b6a433489a596bcac501532a6b6b76666946230bc6510f897 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzM0OjI3NUY0MjoyNkY0NjU4OjM0QkJFOTg6Njk2QURCRTAiLCJ2aXNpdG9yX2lkIjoiMjg2ODY2NTc5Nzc0OTU0NDY0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | beb9c24008336a81edd4d3641490f56e4103200f323e146e7ca169e69aba6d4e |
| hovercard-subject-tag | issue:1595896984 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/102156/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4e87f6b84b669b1e38c865821506fa48034f8391f4cbbeb7336da0a8b89cb393/python/cpython/issues/102156 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4e87f6b84b669b1e38c865821506fa48034f8391f4cbbeb7336da0a8b89cb393/python/cpython/issues/102156 |
| og:image:alt | Bug report The HTTPServer times out as expected before receiving the first request and after receiving the second request. However, HTTPServer doesn't timeout as expected between the first and seco... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eXhumer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 524a93f2c1f36522a3b4be4c110467ee4172245d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width