Skip to content
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

Final part has extra \r\n on end #6

Closed
OrangeDog opened this issue Mar 8, 2012 · 6 comments
Closed

Final part has extra \r\n on end #6

OrangeDog opened this issue Mar 8, 2012 · 6 comments

Comments

@OrangeDog
Copy link

resulting in servers parsing incorrect data.

@tomas
Copy link
Owner

tomas commented Mar 8, 2012

Which part? I've tested on a number of different servers and it works without a problem (I actually read the spec for multipart POST's). If you can show an example it'd also help.

@OrangeDog
Copy link
Author

Using https://github.com/felixge/node-formidable as the parser in the server, and sending a single field via multipart, the end of the request looks like this:

----------------------NODENEEDLEHTTPCLIENT
Content-Disposition: form-data; name="name"

value

----------------------NODENEEDLEHTTPCLIENT--

And on the server JSON.stringify(params.name) gives "value\r\n"

@OrangeDog
Copy link
Author

The problem is that "\r\n" is added to the end of every return_part, and then duplicated at the start of the final boundary.

@tomas
Copy link
Owner

tomas commented Mar 8, 2012

Ok I'll do a test with formidable and fix it if needed. Thanks for the heads up.

@abh
Copy link

abh commented Mar 9, 2012

I agree with OrangeDog that the current code looks wrong in this respect. :-)

@tomas
Copy link
Owner

tomas commented Mar 12, 2012

Ok, tested with formidable. Removing the last \r\n before the final boundary does work. I reread the spec and indeed there is no mention of a double \r\n at the end -- don't really remember why I added it in the first place -- so I'm removing it. Thanks guys.

@tomas tomas closed this as completed Mar 12, 2012
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

No branches or pull requests

3 participants