Skip to content

Adds workaround for Async Multipart uploads greater than 25 kb #574

New issue

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

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

Already on GitHub? # to your account

Merged
merged 2 commits into from
Nov 15, 2020

Conversation

rymndhng
Copy link
Collaborator

Fixes #560

@rymndhng rymndhng requested a review from dakrone November 12, 2020 06:26
(let [os (java.io.ByteArrayOutputStream.)]
(.writeTo mp-entity os)
(.flush os)
(java.io.ByteArrayInputStream. (.toByteArray os))))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

@dakrone dakrone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dakrone
Copy link
Owner

dakrone commented Nov 12, 2020

It does appear there is a suggested workaround in the JIRA issue by wrapping with a BufferedHttpEntity, perhaps that would be a better solution for this?

@rymndhng rymndhng force-pushed the workaround-for-async-multipart-upload branch from 2a62663 to 7edf576 Compare November 14, 2020 19:18
@rymndhng
Copy link
Collaborator Author

@dakrone I gave it a try, but unfortunately it fails for the same reason in my test case. The BufferedHttpEntity may buffer the contents, depending on some of the flags.

See https://github.com/apache/httpcomponents-core/blob/cd88841e0/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java#L58-L68

Removing the checks in the original solution is more reliable to retain the existing behaviour our users expect.

@rymndhng rymndhng merged commit bfce49b into 3.x Nov 15, 2020
@rymndhng rymndhng deleted the workaround-for-async-multipart-upload branch November 15, 2020 18:01
@romashatomar
Copy link

romashatomar commented Jun 3, 2021

Hi,
I am facing "Content too long" exception when trying to update content as a byte array (using multi part form data) using Http Async Client . I see that changes have been made to remove those lines of code . Have they been released ? I am using httpmime : 4.5.12 and I get the same error.

@rymndhng
Copy link
Collaborator Author

@romashatomar the changes were released in clj-http 3.11.0. If you are seeing issues with clj-http, file a new issue and provide reproduction steps and I can help investigate further.

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

Successfully merging this pull request may close these issues.

Async request goes not work when uploading files greater than 25 KB
3 participants