Skip to content

Consuming the request data so the connection closes properly in form-data.submit.#45

Closed
D1plo1d wants to merge 3 commits intoform-data:masterfrom
D1plo1d:master
Closed

Consuming the request data so the connection closes properly in form-data.submit.#45
D1plo1d wants to merge 3 commits intoform-data:masterfrom
D1plo1d:master

Conversation

@D1plo1d
Copy link
Copy Markdown

@D1plo1d D1plo1d commented Jul 13, 2013

This patch fixes the problem where form-data could only submit up to 5 posts to a particular server before it would stall out indefinitely (on the 6th post).

See http://stackoverflow.com/a/16967747/386193

@ghost ghost assigned alexindigo Jul 13, 2013
@alexindigo
Copy link
Copy Markdown
Member

It will be very nice to see the tests. Thank you.

@D1plo1d
Copy link
Copy Markdown
Author

D1plo1d commented Aug 22, 2013

Tested. If you cherry pick that test (a32692d) and run it against the current code it should fail. I changed the test to sending 10 requests and removed res.resume() which isn't documented in the README (with res.resume this issue doesn't happen however this patch renders res.resume unnecessary).

I'm not sure whether this or adding res.resume() to the docs is a better solution but I'll leave that up to you.

@alexindigo
Copy link
Copy Markdown
Member

Thanx for the test.
Btw, does it fail against any particular node version or all 0.6–0.11 are affected?

@D1plo1d
Copy link
Copy Markdown
Author

D1plo1d commented Aug 22, 2013

I'm running v0.10.15. I haven't tested it against any other node versions.

@alexindigo
Copy link
Copy Markdown
Member

I see. I'll play with it.

alexindigo added a commit to alexindigo/form-data that referenced this pull request Aug 22, 2013
@alexindigo
Copy link
Copy Markdown
Member

So if I run your test within original codebase, it doesn't fail for any version (0.6 – 0.11), although it would take it a while to finish in 0.10 and 0.11 (Tried 0.10.12, 0.10.16 and 0.11.5).

This fix, would trigger all the requests into "old mode", which might be not desirable default behavior in 0.10. And in 0.12 it will be non-issue (Streams3 FTW). :)

As for documentation it was discussed in lengths and described here: http://nodejs.org/api/stream.html#stream_compatibility_with_older_node_versions

But you're right, we need to make it more obvious.
I updated readme and I included your (reduced) test into test suite (as separate new entity, we need old tests to make sure we don't break existing stuff).

Thanx a lot.

alexindigo added a commit to alexindigo/form-data that referenced this pull request Aug 22, 2013
alexindigo added a commit that referenced this pull request Aug 22, 2013
#45 Added tests for multi-submit. Updated readme.
@alexindigo alexindigo closed this Aug 22, 2013
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.

2 participants