René's URL Explorer Experiment


Title: Fixed multipart boundary "+++" (since 0.29.0) truncates uploads whose content contains \r\n--+++ · Issue #1509 · openapi-generators/openapi-python-client · GitHub

Open Graph Title: Fixed multipart boundary "+++" (since 0.29.0) truncates uploads whose content contains \r\n--+++ · Issue #1509 · openapi-generators/openapi-python-client

X Title: Fixed multipart boundary "+++" (since 0.29.0) truncates uploads whose content contains \r\n--+++ · Issue #1509 · openapi-generators/openapi-python-client

Description: Describe the bug Since 0.29.0 (#1005), every multipart/form-data request body is sent with a fixed boundary: headers["Content-Type"] = "multipart/form-data; boundary=+++" httpx reads the boundary back from that header when it encodes fil...

Open Graph Description: Describe the bug Since 0.29.0 (#1005), every multipart/form-data request body is sent with a fixed boundary: headers["Content-Type"] = "multipart/form-data; boundary=+++" httpx reads the boundary b...

X Description: Describe the bug Since 0.29.0 (#1005), every multipart/form-data request body is sent with a fixed boundary: headers["Content-Type"] = "multipart/form-data; boundary=+++" httpx ...

Opengraph URL: https://github.com/openapi-generators/openapi-python-client/issues/1509

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fixed multipart boundary \"+++\" (since 0.29.0) truncates uploads whose content contains \\r\\n--+++","articleBody":"**Describe the bug**\n\nSince 0.29.0 (#1005), every `multipart/form-data` request body is sent with a fixed boundary:\n\n```python\nheaders[\"Content-Type\"] = \"multipart/form-data; boundary=+++\"\n```\n\nhttpx reads the boundary back from that header when it encodes `files=`, so the header and the body agree. But a boundary must not occur in the content it delimits (RFC 2046 §5.1.1), and a fixed three-character one can. An uploaded file that contains the bytes `\\r\\n--+++` is split at that point: the server receives a truncated file, and the rest of it as a malformed extra part.\n\nThis used to work for endpoints with a single `multipart/form-data` body. Up to 0.28.x their `_get_kwargs` set no `Content-Type`, and httpx generated a random boundary for each request. #1005 fixed the endpoints with several body types, which sent no boundary at all (#947). As a side effect, the single-body endpoints changed from a random boundary to the fixed one.\n\n**OpenAPI Spec File**\n\n```yaml\nopenapi: 3.0.3\ninfo: {title: Boundary repro, version: \"1.0\"}\npaths:\n  /upload:\n    post:\n      operationId: upload\n      requestBody:\n        required: true\n        content:\n          multipart/form-data:\n            schema:\n              type: object\n              properties:\n                file: {type: string, format: binary}\n      responses:\n        \"200\": {description: OK}\n```\n\nGenerated with `openapi-python-client generate --path openapi.yaml --meta none --output-path client`, then:\n\n```python\nimport email.parser, email.policy, io\nimport httpx\nfrom client import Client\nfrom client.api.default import upload\nfrom client.models.upload_body import UploadBody\nfrom client.types import File\n\ncontent = b\"first line\\r\\n--+++\\r\\nstill the same file\\r\\n\"\nsent = []\ntransport = httpx.MockTransport(lambda r: (r.read(), sent.append(r), httpx.Response(200))[2])\nclient = Client(base_url=\"http://test\", httpx_args={\"transport\": transport})\nupload.sync_detailed(client=client, body=UploadBody(file=File(payload=io.BytesIO(content), file_name=\"a.txt\")))\n\nrequest = sent[-1]\nmessage = email.parser.BytesParser(policy=email.policy.HTTP).parsebytes(\n    b\"Content-Type: \" + request.headers[\"content-type\"].encode() + b\"\\r\\n\\r\\n\" + request.content\n)\nparts = list(message.iter_parts())\nprint(len(parts), parts[0].get_payload(decode=True))\n# 2 b'first line'\n```\n\nThe file arrives as `b'first line'`, and the rest of it becomes a second part. A server sees the same: Rack 3.2.6, which Rails uses, parses this request into `file` = `\"first line\"` plus a stray parameter named `text/plain`.\n\n**Desktop (please complete the following information):**\n - OS: Linux (Ubuntu)\n - Python Version: 3.12.13\n - openapi-python-client version: 0.29.1 (httpx 0.28.1)\n\n**Additional context**\n\nTwo ways to keep #1005's fix without the fixed boundary:\n\n1. **A random boundary for each request, in the template.** For example, `boundary = secrets.token_hex(16)` in `_get_kwargs`, used in the header. httpx would then encode the body with it, as it does with `+++` today. httpx's own default is 16 random bytes in hex.\n2. **No `Content-Type` for an endpoint whose only body is `multipart/form-data`,** as before 0.29.0, so that httpx sets the header with its own random boundary. Only the endpoints with several body types would need the explicit header from (1).\n\nIn practice a collision needs those exact seven bytes in the uploaded content, so it is rare with binary files. But it silently truncates the file, and it reaches the server as a successful upload.\n","author":{"url":"https://github.com/alanwilter","@type":"Person","name":"alanwilter"},"datePublished":"2026-11-05T12:48:29Z","url":"https://github.com/openapi-generators/openapi-python-client/issues/1509"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:9b3d018e-dac9-aa9d-1e28-a9151dd608a4
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBCDC:129351:765FE3:974118:6B035A99
html-safe-nonce1e3f9d090f4b01e2169cbbdc59b4c55554477c477c3bd9f3b36b0caf60af7ed9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQ0RDOjEyOTM1MTo3NjVGRTM6OTc0MTE4OjZCMDM1QTk5IiwidmlzaXRvcl9pZCI6IjQ0Nzg0ODI2MTc0NjkxOTY5NTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaca349c013fb8f9f3b87ace606f2c35363b6bdb88ddff064c7c3666f31f1f86f6e
hovercard-subject-tagissue:6223489591
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/openapi-generators/openapi-python-client/1509/issue_layout
twitter:imagehttps://opengraph.githubassets.com/74ba0b376b32017fe24d6ed71af90b8d5c80d2732c18fdc8efff0f770a0c5c4a/openapi-generators/openapi-python-client/issues/1509
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/74ba0b376b32017fe24d6ed71af90b8d5c80d2732c18fdc8efff0f770a0c5c4a/openapi-generators/openapi-python-client/issues/1509
og:image:altDescribe the bug Since 0.29.0 (#1005), every multipart/form-data request body is sent with a fixed boundary: headers["Content-Type"] = "multipart/form-data; boundary=+++" httpx reads the boundary b...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamealanwilter
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/openapi-generators/openapi-python-client git https://github.com/openapi-generators/openapi-python-client.git
octolytics-dimension-user_id84925606
octolytics-dimension-user_loginopenapi-generators
octolytics-dimension-repository_id240776275
octolytics-dimension-repository_nwoopenapi-generators/openapi-python-client
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id240776275
octolytics-dimension-repository_network_root_nwoopenapi-generators/openapi-python-client
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/openapi-generators/openapi-python-client/issues/1509#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenapi-generators%2Fopenapi-python-client%2Fissues%2F1509
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenapi-generators%2Fopenapi-python-client%2Fissues%2F1509
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=openapi-generators%2Fopenapi-python-client
Reloadhttps://github.com/openapi-generators/openapi-python-client/issues/1509
Reloadhttps://github.com/openapi-generators/openapi-python-client/issues/1509
Reloadhttps://github.com/openapi-generators/openapi-python-client/issues/1509
openapi-generatorshttps://github.com/openapi-generators
openapi-python-clienthttps://github.com/openapi-generators/openapi-python-client
Codehttps://github.com/openapi-generators/openapi-python-client
Issues94 (94)https://github.com/openapi-generators/openapi-python-client/issues
Pull requests36 (36)https://github.com/openapi-generators/openapi-python-client/pulls
Discussionshttps://github.com/openapi-generators/openapi-python-client/discussions
Actionshttps://github.com/openapi-generators/openapi-python-client/actions
Security and quality4 (4)https://github.com/openapi-generators/openapi-python-client/security
Insightshttps://github.com/openapi-generators/openapi-python-client/insights
https://github.com/openapi-generators/openapi-python-client
New issuehttps://github.com/login?return_to=https://github.com/openapi-generators/openapi-python-client/issues/1509
New issuehttps://github.com/login?return_to=https://github.com/openapi-generators/openapi-python-client/issues/1509
#1511https://github.com/openapi-generators/openapi-python-client/pull/1511
eye2gene/e2g-workflows#5https://github.com/eye2gene/e2g-workflows/pull/5
Fixed multipart boundary "+++" (since 0.29.0) truncates uploads whose content contains \r\n--+++https://github.com/openapi-generators/openapi-python-client/issues/1509#top
#1511https://github.com/openapi-generators/openapi-python-client/pull/1511
eye2gene/e2g-workflows#5https://github.com/eye2gene/e2g-workflows/pull/5
https://github.com/alanwilter
alanwilterhttps://github.com/alanwilter
on Nov 5, 2026https://github.com/openapi-generators/openapi-python-client/issues/1509#issue-6223489591
#1005https://github.com/openapi-generators/openapi-python-client/pull/1005
#1005https://github.com/openapi-generators/openapi-python-client/pull/1005
#947https://github.com/openapi-generators/openapi-python-client/issues/947
#1005https://github.com/openapi-generators/openapi-python-client/pull/1005
dbantyhttps://github.com/dbanty
completedhttps://github.com/openapi-generators/openapi-python-client/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#1511https://github.com/openapi-generators/openapi-python-client/pull/1511
on Nov 7, 2026https://github.com/openapi-generators/openapi-python-client/issues/1509#event-35457752884
sda-mikerocheforthttps://github.com/sda-mikerochefort
on Nov 7, 2026https://github.com/openapi-generators/openapi-python-client/issues/1509#event-35462234986
fix: Let httpx2 choose the multipart/form-data boundary (openapi-gene…https://github.com/sda-mikerochefort/openapi-python-client/commit/4d6baa7525aa7a2c34f4b279f4d8854f03cd0799
openapi-gene…https://github.com/openapi-generators/openapi-python-client/pull/1511
https://docs.github.com/articles/closing-issues-via-commit-messages
4d6baa7https://github.com/sda-mikerochefort/openapi-python-client/commit/4d6baa7525aa7a2c34f4b279f4d8854f03cd0799
Release 0.30.0 (openapi-generators#1510)https://github.com/sda-mikerochefort/openapi-python-client/commit/46a4340cf4dbf945a476a70f7a0a2c9eeb4f0156
openapi-generators#1510https://github.com/openapi-generators/openapi-python-client/pull/1510
https://docs.github.com/articles/closing-issues-via-commit-messages
46a4340https://github.com/sda-mikerochefort/openapi-python-client/commit/46a4340cf4dbf945a476a70f7a0a2c9eeb4f0156
alanwilterhttps://github.com/alanwilter
on Nov 9, 2026https://github.com/openapi-generators/openapi-python-client/issues/1509#event-35560349357
chore(quarantine): allow openapi-python-client 0.30.0 for openapi-gen…https://github.com/eye2gene/e2g-workflows/commit/bb6f2dca8eddc1beaa7f9ac6bb641dec6ff8f004
openapi-gen…https://github.com/openapi-generators/openapi-python-client/issues/1509
bb6f2dchttps://github.com/eye2gene/e2g-workflows/commit/bb6f2dca8eddc1beaa7f9ac6bb641dec6ff8f004
Merge pull request #5 from eye2gene/allow/openapi-python-client-0.30.…https://github.com/eye2gene/e2g-workflows/commit/d6970e62cb2f73544f9a1753e1f6c41e6fa115d4
#5https://github.com/eye2gene/e2g-workflows/pull/5
d6970e6https://github.com/eye2gene/e2g-workflows/commit/d6970e62cb2f73544f9a1753e1f6c41e6fa115d4
Sign up for freehttps://github.com/signup?return_to=https://github.com/openapi-generators/openapi-python-client/issues/1509
Sign in to commenthttps://github.com/login?return_to=https://github.com/openapi-generators/openapi-python-client/issues/1509
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.