Export to GitHub

v8cgi - issue #90

Upload does not work


Posted on Feb 19, 2011 by Happy Elephant

What steps will reproduce the problem? 1. Multipart is broken, so try any with several fields

What version of the product are you using? On what operating system? 0.9.0 linux

Please provide any additional information below.

Here is a patch:

germany:/download/js/v8cgi/v8cgi/lib# diff http.js.orig http.js 93a94 > 112c113,114

< boundary = "--"+boundary;

> var boundary1 = "--"+boundary; > var boundary2 = "\r\n--"+boundary; 117c119

< if (index1 != 0) { boundary = "\r\n" + boundary; } /* 2nd and next boundaries start with newline */

> boundary=(index1==0)?boundary1:boundary2; /* 2nd and next boundaries start with newline */

Comment #1

Posted on Feb 19, 2011 by Happy Giraffe

(No comment was entered for this change.)

Comment #2

Posted on Feb 19, 2011 by Happy Giraffe

Fixed in r908, please test.

Comment #3

Posted on Mar 14, 2011 by Happy Giraffe

(No comment was entered for this change.)

Comment #4

Posted on Apr 26, 2011 by Happy Elephant

Not working for files >15k. stdin is not reading everything.

Attachments

Comment #5

Posted on Apr 26, 2011 by Happy Giraffe

What is your setup and v8cgi version? I believe that the current trunk HEAD works with files >15k; moreover, your patch seems to break things; both in http.js and system.cc.

1) HTTP uploader is responsible for providing the content-length header in order to know the input size;

2) as soon as the app->reader returns value lower than the requested amount, the reading should stop: there are not enough bytes available. Waiting for a larger amount might result in an infinite wait...

Please correct me if I am mistaken.

Comment #6

Posted on Apr 27, 2011 by Happy Elephant

I got it to read indefinately cause I didn't know how to append things to the binary buffer, is there a way to do that?

Try to upload a large file with the below script, it doesn't work for me, using the svn version.

Actually my patch isn't working well, works for the large file but doesn't seem to work for any other params that go with the file upload.

Thanks.

Attachments

Comment #7

Posted on Apr 27, 2011 by Happy Giraffe

Hi,

1) a Buffer has a fixed length, http://wiki.commonjs.org/wiki/Binary/F . To append to Buffer, one must create a new (larger) one and copy contents from the older Buffer.

2) your attached script works just fine for me - SVN version of v8cgi, running in CGI mode. You can temporarily try it at http://tl.zarovi.cz/fileupload.ssjs .

3) How do you invoke v8cgi? I have not tried your script with v8cgi as Apache module, maybe that might pose a problem .. ?

Comment #8

Posted on Apr 27, 2011 by Happy Elephant

Yes, I am using it via mod_v8cgi.so

x64 ubuntu 10.10

Comment #9

Posted on Apr 27, 2011 by Happy Giraffe

The problem was confirmed on my configuration as well: when running as Apache module, upload of larger files does not work. Re-opening.

Comment #10

Posted on Apr 27, 2011 by Happy Giraffe

Erm, it actually works, just my Apache configuration was incorrect :-(

This means that I am unable to reproduce the problem (Apache 32bit, Debian). I will try to reproduce on your environment on x64 ubuntu, stay tuned. In the meantime, please post your apache configuration file...

Comment #11

Posted on Apr 27, 2011 by Happy Elephant

I'm just using the default apache config. Does anything special need to be changed?

It maybe different visiting the site remotely instead of on the same machine. When it's on the same machine the stdin buffer maybe be full always, but remotely the file may upload a little bit at a time causing the read() function to read only a little to the buffer, and not the full buffer so it may stop before reaching the end of the file.

Attachments

Comment #12

Posted on Apr 27, 2011 by Happy Giraffe

(No comment was entered for this change.)

Comment #13

Posted on Apr 27, 2011 by Happy Giraffe

I just commited a fix in the mod_v8cgi. I believe this should fix things.

Please:

  • svn up
  • recompile
  • restart apache

Let me know if this resolves the issue.

Comment #14

Posted on Apr 27, 2011 by Happy Elephant

Thanks for your quick response! It's working fine now!

Comment #15

Posted on Apr 27, 2011 by Happy Giraffe

(No comment was entered for this change.)

Status: Fixed

Labels:
Type-Defect Priority-Medium