Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Chunked Requests do not work in Iron Framework #54

Closed
cetra3 opened this issue Dec 1, 2016 · 10 comments · Fixed by #65
Closed

Chunked Requests do not work in Iron Framework #54

cetra3 opened this issue Dec 1, 2016 · 10 comments · Fixed by #65
Milestone

Comments

@cetra3
Copy link

cetra3 commented Dec 1, 2016

Not sure where the problem lies here but appears that the multipart intercept in iron gets stuck on a chunked boundary.

Not normally an issue if you use this via curl, but the multipart hyper client appears to send it in chunks which is not read correctly by the multipart iron handler.

Steps to test:

  • Submit to an iron request with the intercept enabled and a println!("{:?}", entries) statement above the response:
sudo cargo run --features all --example iron_intercept

Watch the println output of the iron request:

Entries { fields: {}, files: {}, dir: Temp(TempDir { path: "/tmp/multipart.fcIrXAW1ERnN" }) }

Notice that there are no files.

With curl (curl -F "file=@lorem_ipsum.txt" localhost) this works ok:

Entries { fields: {}, files: {"file": SavedFile { path: "/tmp/multipart.GgWgbNoThb1U/kJiP8pJ5MRNr", filename: Some("lorem_ipsum.txt"), size: 5 }}, dir: Temp(TempDir { path: "/tmp/multipart.GgWgbNoThb1U" }) }
@abonander
Copy link
Owner

I believe that I have resolved this in 0.9.0-alpha.4 as part of various fixes for #51. Try that version and see if it still has a problem.

@cetra3
Copy link
Author

cetra3 commented Dec 1, 2016

@abonander is 0.9.0-alpha.4 released here? Or is it just on crates.io

@abonander
Copy link
Owner

It is published on crates.io; the source is the httparse branch in this repo.

@cetra3
Copy link
Author

cetra3 commented Dec 1, 2016

@abonander it seems like it's better, i.e, it's finding the file, but I get the following error in the logs:

ERROR:hyper::server: request error = TooLarge

And the checksum of the file doesn't match, it appears to include the newline characters at the end of it (2 extra bytes).

Before Upload

File contents:

A test File

Hex output:

0000000 41 20 74 65 73 74 20 46 69 6c 65 0a            
000000c

After Upload

File contents:

A test File

Hex output:

0000000 41 20 74 65 73 74 20 46 69 6c 65 0a 0d 0a      
000000e

@abonander
Copy link
Owner

abonander commented Dec 14, 2016

@cetra3 Try with multipart = "0.9.0-alpha.5". I've rewritten a lot of the boundary parsing, it shouldn't ever allow those extra newline characters.

@abonander
Copy link
Owner

Ping @cetra3, I'm waiting for your response (and someone else's) before I publish 0.9.0.

@Boscop
Copy link

Boscop commented Jan 6, 2017

With 0.8.1 I'm always getting "Unexpected 2-bytes after boundary: [0, 0]" when trying to upload images as part of a form like this.

@abonander
Copy link
Owner

@Boscop Try multipart = "0.9.0-alpha.9", there's a lot of bugfixes that are almost ready for a full release.

@Boscop
Copy link

Boscop commented Jan 7, 2017

I'm using the params crate which depends on multipart 0.8.1. So I can't use [replace] to use a different version...

@abonander
Copy link
Owner

abonander commented Jan 10, 2017

@Boscop You can try cloning params locally and updating the multipart version but I'll probably just go ahead and publish a release version and ask them to update.

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

Successfully merging a pull request may close this issue.

3 participants