Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(multipart): always stream body #116

Merged
merged 1 commit into from
Apr 22, 2022
Merged

Conversation

lucasfernog
Copy link
Contributor

The multipart crate used by attohttpc has an issue when the form has only text fields, they are not computing the content length properly. I believe the problem is here where the text_data is appended with the proper value but the content_len is not changed (so you only get the right body posted when use_len === false. I could open a PR to their repo but I'm afraid it won't be merged since the project seems unmaintained, so I open this change here hoping it won't cause any issues.

@lucasfernog
Copy link
Contributor Author

Forgot to mention, you can see the issue by removing the with_file call in the multipart example.

@sbstp
Copy link
Owner

sbstp commented Apr 22, 2022

Ok that's sounds reasonable. Thanks for fixing this.

@sbstp sbstp merged commit 7179914 into sbstp:master Apr 22, 2022
@sbstp
Copy link
Owner

sbstp commented Apr 23, 2022

out in v0.19.1

@lucasfernog lucasfernog deleted the fix/multipart branch April 23, 2022 00:59
@lucasfernog
Copy link
Contributor Author

Thank you ❤️

@adamreichold
Copy link
Contributor

Note this might be problematic: I stumbled over API that forbid chunked encoding of post bodies (presumably to simplify their body length checks). If upstream is really unmaintained, then perhaps searching an alternative or creating a fork is in order?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants