wqx081 / v8cgi

Automatically exported from code.google.com/p/v8cgi
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Upload does not work #90

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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 */

Original issue reported on code.google.com by vahv...@gmail.com on 19 Feb 2011 at 7:29

GoogleCodeExporter commented 8 years ago

Original comment by ondrej.zara on 19 Feb 2011 at 2:58

GoogleCodeExporter commented 8 years ago
Fixed in r908, please test.

Original comment by ondrej.zara on 19 Feb 2011 at 3:00

GoogleCodeExporter commented 8 years ago

Original comment by ondrej.zara on 14 Mar 2011 at 7:21

GoogleCodeExporter commented 8 years ago
Not working for files >15k.  stdin is not reading everything.

Original comment by nik...@gmail.com on 26 Apr 2011 at 5:29

Attachments:

GoogleCodeExporter commented 8 years ago
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.

Original comment by ondrej.zara on 26 Apr 2011 at 8:14

GoogleCodeExporter commented 8 years ago
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.

Original comment by nik...@gmail.com on 27 Apr 2011 at 5:34

Attachments:

GoogleCodeExporter commented 8 years ago
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 .. ?

Original comment by ondrej.zara on 27 Apr 2011 at 5:47

GoogleCodeExporter commented 8 years ago
Yes, I am using it via mod_v8cgi.so

x64 ubuntu 10.10

Original comment by nik...@gmail.com on 27 Apr 2011 at 5:52

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

Original comment by ondrej.zara on 27 Apr 2011 at 5:56

GoogleCodeExporter commented 8 years ago
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...

Original comment by ondrej.zara on 27 Apr 2011 at 6:16

GoogleCodeExporter commented 8 years ago
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.

Original comment by nik...@gmail.com on 27 Apr 2011 at 6:26

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by ondrej.zara on 27 Apr 2011 at 6:55

GoogleCodeExporter commented 8 years ago
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.

Original comment by ondrej.zara on 27 Apr 2011 at 6:56

GoogleCodeExporter commented 8 years ago
Thanks for your quick response!  It's working fine now!

Original comment by nik...@gmail.com on 27 Apr 2011 at 8:23

GoogleCodeExporter commented 8 years ago

Original comment by ondrej.zara on 27 Apr 2011 at 6:28