Skip to content

Conversation

@Procionegobbo
Copy link

Content-Length in multipart bodies is not necessary. As far as I can verify is not used in any browser or other HTTP client.

For reference

@GrahamCampbell
Copy link
Member

Thanks for sending this in. I wanna wait till 3.0.0 to make this change. There are some other arguably breaking changes to make at the same time as this.

@GrahamCampbell
Copy link
Member

3.0.0 should be coming out this year, if I can find the time to work on it.

@GrahamCampbell GrahamCampbell changed the title Remove default content-length header from MultipartStream class [3.0] Remove default content-length header from MultipartStream class Sep 10, 2023
@stale
Copy link

stale bot commented Mar 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you for your contributions.

@marcogermani87
Copy link

marcogermani87 commented Apr 9, 2024

I think this pull request is very important.

Some legacies system can't manage the "Content-Length" header into "multipart/form-data" boundary and cut off the request.

For reference see the RFC 7578 in section 4.8 wich specify:

4.8. Other "Content-" Header Fields

The multipart/form-data media type does not support any MIME header
fields in parts other than Content-Type, Content-Disposition, and (in
limited circumstances) Content-Transfer-Encoding. Other header
fields MUST NOT be included and MUST be ignored.

Older system are not compliant because not apply the MUST be ignore policy but on the other side this code non apply the MUST NOT be included policy.

@stale stale bot removed the lifecycle/stale label Apr 9, 2024
@GrahamCampbell
Copy link
Member

I don't disagree. A 3.0 release is still planned.

@marcogermani87
Copy link

marcogermani87 commented Apr 12, 2024

I don't disagree. A 3.0 release is still planned.

Thanks, do you have an expected release date?

@GrahamCampbell
Copy link
Member

No, not yet. I hope some time in the summer.

@GrahamCampbell
Copy link
Member

I am likely to create a 3.0 branch in the next few days/weeks, and merge this, so you may be able to use an experimental 3.0-dev version for a bit if you want.

@marcogermani87
Copy link

marcogermani87 commented Apr 12, 2024

I am likely to create a 3.0 branch in the next few days/weeks, and merge this, so you may be able to use an experimental 3.0-dev version for a bit if you want.

Yes, of course; after merge i can use the experimental 3.0-dev. Actually i've already overrided in my project Client.php and MultipartStream.php files for exclude the "Content-Length" and works well.

@marcogermani87
Copy link

Hi @GrahamCampbell, any news on this?

@GrahamCampbell
Copy link
Member

This is for sure still planned for 3.0.0.

@stale
Copy link

stale bot commented Feb 1, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you for your contributions.

@stale stale bot added the lifecycle/stale label Feb 1, 2025
@GrahamCampbell
Copy link
Member

Not stale.

@stale
Copy link

stale bot commented Jun 26, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you for your contributions.

@GrahamCampbell
Copy link
Member

Not stale.

@stale stale bot removed the lifecycle/stale label Jun 27, 2025
@Cristobal-M
Copy link

Cristobal-M commented Jul 4, 2025

I'm experiencing a similar issue with a banking system. I couldn't figure out why it was returning a 500 error when using Guzzle, but not when sending a raw body with with curl.

Turns out the difference was that I wasn't setting the Content-Length header when using curl directly for each content.

For now, I'm working around it by using a custom StreamInterface and setting the boundary manually in the Content-Type header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants