Title: http.client._MAXHEADERS = 100 limit no longer sufficient · Issue #131724 · python/cpython · GitHub
Open Graph Title: http.client._MAXHEADERS = 100 limit no longer sufficient · Issue #131724 · python/cpython
X Title: http.client._MAXHEADERS = 100 limit no longer sufficient · Issue #131724 · python/cpython
Description: Bug report Bug description: This hard-coded sanity check for HTTP response headers is no longer sufficient to fetch a Microsoft 365 page. cpython/Lib/http/client.py Line 112 in 0a91456 _MAXHEADERS = 100 I do have a case open with Microso...
Open Graph Description: Bug report Bug description: This hard-coded sanity check for HTTP response headers is no longer sufficient to fetch a Microsoft 365 page. cpython/Lib/http/client.py Line 112 in 0a91456 _MAXHEADERS ...
X Description: Bug report Bug description: This hard-coded sanity check for HTTP response headers is no longer sufficient to fetch a Microsoft 365 page. cpython/Lib/http/client.py Line 112 in 0a91456 _MAXHEADERS ...
Opengraph URL: https://github.com/python/cpython/issues/131724
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"http.client._MAXHEADERS = 100 limit no longer sufficient","articleBody":"# Bug report\n\n### Bug description:\n\nThis hard-coded sanity check for HTTP response headers is no longer sufficient to fetch a Microsoft 365 page. \n\nhttps://github.com/python/cpython/blob/0a91456ad14bb598646f50bf8f034e8887c0c468/Lib/http/client.py#L112\n\nI do have a case open with Microsoft Support (TrackingID#2503130010002871), but it's not getting much traction as it's not causing problems with full web browsers.\n\nSteps to reproduce:\n\n```python\nimport http.client\ncon = http.client.HTTPSConnection('outlook.office365.com')\ncon.request(\"GET\", \"/owa/example.edu\") # any domain seems to trigger\nr = con.getresponse()\n```\n\nAnd that throws a HTTPException\n```\n>>> con = http.client.HTTPSConnection('outlook.office365.com')\n>>> con.request(\"GET\", \"/owa/foo.bar\")\n>>> r = con.getresponse()\nTraceback (most recent call last):\n File \"\u003cpython-input-8>\", line 1, in \u003cmodule>\n r = con.getresponse()\n File \"C:\\Users\\jmacdone\\AppData\\Local\\Programs\\Python\\Python313-arm64\\Lib\\http\\client.py\", line 1428, in getresponse\n response.begin()\n ~~~~~~~~~~~~~~^^\n File \"C:\\Users\\jmacdone\\AppData\\Local\\Programs\\Python\\Python313-arm64\\Lib\\http\\client.py\", line 350, in begin\n self.headers = self.msg = parse_headers(self.fp)\n ~~~~~~~~~~~~~^^^^^^^^^\n File \"C:\\Users\\jmacdone\\AppData\\Local\\Programs\\Python\\Python313-arm64\\Lib\\http\\client.py\", line 248, in parse_headers\n headers = _read_headers(fp)\n File \"C:\\Users\\jmacdone\\AppData\\Local\\Programs\\Python\\Python313-arm64\\Lib\\http\\client.py\", line 226, in _read_headers\n raise HTTPException(\"got more than %d headers\" % _MAXHEADERS)\nhttp.client.HTTPException: got more than 100 headers\n>>>\n```\n\nIt seems to be just spilling over with 101 headers. Though, not consistently. Presumably it depends upon which load balancer node is responding.\n\n\n```bash\n$ curl --silent -D - 'https://outlook.office365.com/owa/example.edu' | grep -E \"^[a-zA-Z-]+: \" | wc -l\n```\nreturns with 96, 99, 101, etc. headers, depending on ~Microsoft's mood~ unknown factors.\n\nFor background, it's common to use `https://outlook.com/example.edu` as a domain hint (\"smart link\") to go directly to a tenant's identity provider and avoid the \"Please provide your email address\" step. We have a nagios check for that, which broke recently as the number of `Set-Cookie: OpenIdConnect.token.[...]` variants continues to grow.\n\n### CPython versions tested on:\n\n3.13, 3.9, 3.11\n\n### Operating systems tested on:\n\nLinux, Windows\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-136814\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/jmacdone","@type":"Person","name":"jmacdone"},"datePublished":"2025-03-25T16:27:47Z","url":"https://github.com/python/cpython/issues/131724"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| 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:d0cef262-6981-acd1-fe38-9a16277e01df |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C222:1F6DC:20722D:2B75EF:6AECC433 |
| html-safe-nonce | 9cb74d97c760669afc4374971109c4fc39b2348aee1322be75149795c782f67a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjIyOjFGNkRDOjIwNzIyRDoyQjc1RUY6NkFFQ0M0MzMiLCJ2aXNpdG9yX2lkIjoiNDE5MzQ3MDgwODIwMzI0ODY5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 578ae77fed198378ac12ad442859c3d0ae316e099a1b935d90372d3761828f14 |
| hovercard-subject-tag | issue:2947117446 |
| 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/131724/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c59d062eb198918dad01a252d8601d2e2719b5a76f2ff246acf0e8b111fa43d1/python/cpython/issues/131724 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c59d062eb198918dad01a252d8601d2e2719b5a76f2ff246acf0e8b111fa43d1/python/cpython/issues/131724 |
| og:image:alt | Bug report Bug description: This hard-coded sanity check for HTTP response headers is no longer sufficient to fetch a Microsoft 365 page. cpython/Lib/http/client.py Line 112 in 0a91456 _MAXHEADERS ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jmacdone |
| hostname | github.com |
| expected-hostname | github.com |
| None | dc0b519c5798dc1150b88dc4c06a8b9634d0069218dc04e469970e76aad74016 |
| 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 | db139f0bf57b59bf9a8c4abb0849924d6c6ca559 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width