-
Notifications
You must be signed in to change notification settings - Fork 380
Do not assume we can determine content length for generic Readable streams. #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…s not correspond to a file descriptor.
…not known (as in the case of data from a ReadableStream.)
|
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? |
|
It will go to v0.2. |
|
@alexindigo using chunked encoding is the way to go for unknown length bodies, and thus parts in multipart bodies.
See request/request#1283. I don't know about browser support though. |
|
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. |
|
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 On 08/12/2014 18:48, Alex Indigo wrote:
|
|
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue found: Expected '{' and instead saw 'request'.
|
This PR has been out of shape for some time, Thank you. |
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.