danabr / multipart-parser

A multipart parser written in Ruby
MIT License
17 stars 10 forks source link

Tests are not passing #3

Closed paneq closed 6 years ago

paneq commented 12 years ago
/home/rupert/binary/ruby-1.9.2-p290/bin/ruby -w -I"lib:test" -I"/home/rupert/binary/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.3.beta.1/lib" "/home/rupert/binary/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.3.beta.1/lib/rake/rake_test_loader.rb" "test/multipart_parser/parser_test.rb" "test/multipart_parser/reader_test.rb" 
Loaded suite /home/rupert/binary/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.3.beta.1/lib/rake/rake_test_loader
Started
F....FF
Finished in 0.001119 seconds.

  1) Failure:
test_fixtures(MultipartParser::ParserTest) [/home/rupert/develop/multipart-parser/test/multipart_parser/parser_test.rb:88]:
<true> expected but was
<false>.

  2) Failure:
test_long(MultipartParser::ReaderTest) [/home/rupert/develop/multipart-parser/test/multipart_parser/reader_test.rb:97]:
Failed assertion, no message given.

  3) Failure:
test_success_scenario(MultipartParser::ReaderTest) [/home/rupert/develop/multipart-parser/test/multipart_parser/reader_test.rb:57]:
Failed assertion, no message given.

7 tests, 11 assertions, 3 failures, 0 errors, 0 skips

Including the one that I submitted in another pull request.

danabr commented 12 years ago

Thanks for the heads-up. When I wrote this, I was running it under 1.8.7, where the (old) tests still pass. Running them under 1.9 produces the errors you mention, though. I'm on vacation this week, meaning that I might actually be able to look into it :)

Asmod4n commented 10 years ago

@danabr i am also getting errors with html5 FormData in all Webkit browsers at least, could you take a look at it?

danabr commented 10 years ago

Hi Hendrik,

I wrote/converted this multipart parser many years ago now, and have not used it after the first project (a prototype for my thesis project) I needed it for. I'm not convinced I remember enough details to be able to solve the problems.

I'll try to have a look this week, but I won't promise anything. Feel free to come up with a patch!

Asmod4n commented 10 years ago

@danabr when i take a look at a normal form and a javascript FormData i can't see a difference, but its complaining https://github.com/danabr/multipart-parser/blob/master/lib/multipart_parser/reader.rb#L46 here, maybe newline handling isn't corrent?

danabr commented 10 years ago

I intend test some different scenarios with recent browsers to try to understand the issue. You can help by sending the raw multipart message that the browser sends to the server, so that we can use it as a test case.

danabr commented 10 years ago

I've done tests with the most recent firefox and chromium recently, and I have been able to parse form data generated by them. To me it seems like the "long boundary" test is incorrect. But you are saying you have problems parsing real, browser-generated, multipart/form-data messages, right?

Asmod4n commented 10 years ago

Yes, i am having trouble with javascript FormData. In WebKit.

Von einem mobilen Gerät gesendet

Am 12.05.2014 um 11:11 schrieb Daniel Abrahamsson notifications@github.com:

I've done tests with the most recent firefox and chromium recently, and I have been able to parse form data generated by them. To me it seems like the "long boundary" test is incorrect. But you are saying you have problems parsing real, browser-generated, multipart/form-data messages, right?

— Reply to this email directly or view it on GitHub.

danabr commented 10 years ago

Could you start a netcat session with "nc -l 8888", and then make your form post to "localhost:8888", and then post the output (from netcat) here?

Asmod4n commented 10 years ago

I'll make a gist of it soonish.

Von einem mobilen Gerät gesendet

Am 12.05.2014 um 11:44 schrieb Daniel Abrahamsson notifications@github.com:

Could you start a netcat session with "nc -l 8888", and then make your form post to "localhost:8888", and then post the output (from netcat) here?

— Reply to this email directly or view it on GitHub.

digitalextremist commented 10 years ago

@Asmod4n I am using Safari, testing a celluloid/reel implementation of this library, and I've successfully used moxiecode/plupload ( html5 mode ) and an ordinary html form field. So I've used JavaScript FormData successfully.

Once I post the code to a branch of Reel, maybe we can find what's going on for you?

Asmod4n commented 10 years ago

Oh i forgot, have used it inside a web worker for chunked uploading, and since FormData is not available there i took https://gist.github.com/lemonhall/3120320 as a polyfill, maybe the error is there.

Made a gist of a now disfunct uploader: https://gist.github.com/Asmod4n/28e5440fd47af471da9c crypto.js is from https://code.google.com/p/crypto-js/

digitalextremist commented 10 years ago

Will check that out shortly, and be in #celluloid to talk if you're around.

danabr commented 10 years ago

Again, it would be helpful to get the full request sent to the server (by using netcat, for example).