Skip to content

Conversation

@amberdixon
Copy link

I started using a library which provided me with data as a stream.Readable object. This readable stream did not come from a file (i.e. it was not created using fs.createReadStream(..)). I noticed that the code was incorrectly assuming a certain content-length. I have made fixes to getLength, getLengthSync and submit to make sure that we do not incorrectly assume the content-length for stream data.

…not known (as in the case of data from a ReadableStream.)
@alexindigo
Copy link
Member

Thanks for the for PR and interest in the project. Let's discuss the changes first.

If there is no content length, how you see it being sent over the wire, most of web services still require Content-Length header. Although I do agree that we should be more strict with our assumption on incoming streams. And tests failed in node-0.8 which is a bummer.

I'm curious about the use case, I mean how you're planning to submit your data to the web service, buffer everything up or to use chunked encoding?

@alexindigo alexindigo self-assigned this Jun 23, 2014
@alexindigo alexindigo added this to the v0.2 milestone Jun 23, 2014
@alexindigo
Copy link
Member

It will go to v0.2.

@thomas-riccardi
Copy link

@alexindigo using chunked encoding is the way to go for unknown length bodies, and thus parts in multipart bodies.

node-form-data already uses combined-stream so it can easily use chunked encoding (node.js http module will do the encoding itself if you set the transfer-encoding: chunked header value).

See request/request#1283.

I don't know about browser support though.

@alexindigo
Copy link
Member

Its not about browser support, but more on the side of server support, in my testing only node based web server properly deal with POST requests with chunked encoding. But node is growing, so it probably makes sense to add this feature to the project.

@thomas-riccardi
Copy link

I saw PR for browser support, so I added this information here.

I know some server don't support that, but other do (like nodejs, but
also custom http servers...). And we don't break anything: if the
multipart only uses known length parts, then we can still send a
Content-Length and no chunked encoding.
This feature just adds more supported use cases, when it's possible.

On 08/12/2014 18:48, Alex Indigo wrote:

Its not about browser support, but more on the side of server support,
in my testing only node based web server properly deal with POST
requests with chunked encoding. But node is growing, so it probably
makes sense to add this feature to the project.


Reply to this email directly or view it on GitHub
#70 (comment).

@alexindigo
Copy link
Member

Do you mind to create separate test that illustrates the issue? That way we can be sure of backwards compatibility with existing applications while addressing your concern. Thank you.

Copy link
Member

Choose a reason for hiding this comment

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

@alexindigo
Copy link
Member

This PR has been out of shape for some time,
and at this point it will be better to create fresh one with updated base.
And only necessary changes to the main file.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants