alexcrichton / tokio-curl

Asynchronous HTTP client built on libcurl
Apache License 2.0
110 stars 15 forks source link

A multiform request causes tokio-curl to get stuck #9

Closed bytesnake closed 7 years ago

bytesnake commented 7 years ago

I'm trying to upload a large file by a multiform request. When tokio-curl attempts to upload the file content, it will always wait for an answer from the server to continue after the first packet. Rust-curl uploads the packets without awaiting some responds though.

Example

alexcrichton commented 7 years ago

Thanks for the report! I tested this out locally sending the payload to http://httpbin.com/post but was unfortunately unable to reproduce. What server were you using locally to test this against? That may help me to reproduce and dig into what's going on.

bytesnake commented 7 years ago

Well, I've prototyped a rust bot library based on curl. Everything is working fine except uploading a file larger than 32kB (?). I've already tried to disable the except header but the bot server confirms the header and it accepts a small file without any problem. To reproduce the case you will need a telegram bot api key, here is a small test: https://gist.github.com/anonymous/3f70dee7f0f689034d6accac6a98f435 I created a example server with netcat and observed the behaviour of curl. Sometimes it's easier to illustrate:

tokio-curl: ex1

rust-curl: ex2

Did I miss something or is this an intended behaviour? It seems like the event loop awaits a new incoming packet before sending the next one.

alexcrichton commented 7 years ago

Thanks for the info! I've been able to reproduce locally, and I think that https://github.com/tokio-rs/tokio-curl/commit/de0ecf39c5fe0420db8a6fe576154b4b0c617ed5 should fix the problem. Could you test it out though and confirm that it works?

bytesnake commented 7 years ago

jep upload is working now, you're awesome, thanks!

alexcrichton commented 7 years ago

Ok, I've published 0.3.6 with these changes, thanks for testing!