I got strange upload issues on my app. A simple form with an upload
field fails sometimes to upload the file. It works fine on my LAN but
fails on the Internet.
I focused it down to this reproducible scenario :

I install a clean web2py with an ssl certificate :

cd /var
wget http://www.web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
cd /var/web2py/
dd if=/dev/random of=rand.dat bs=1024 count=1
openssl genrsa -out cakey.key -rand rand.dat 2048
openssl req -new -key cakey.key -out cakey.csr -subj
'/C=FR/L=Paris/CN=test25656263.test.fr'
openssl x509 -req -days 1780 -set_serial 1 -in cakey.csr -signkey
cakey.key -out cakey.pem
rm -f rand.dat

I start web2py in SSL mode :
python web2py.py -i 0.0.0.0 -p 443 -c cakey.pem -k cakey.key

With the admin interface, I create my test app :
New simple application
Application name: testupload1

Modify db.py and add :
db.define_table('mytable',
   Field('myfield', 'upload'),
 )

Go to database administration : [ insert new mytable ]
select a small file (50 kb) then submit

Then I got :
-> "Internal error" Ticket issued ...
testupload1/81.56.220.102.2011-01-03.11-26-20.6a65f307-5eb2-4fde-915d-
d63516bc574a
-> Bad Request

Traceback (most recent call last):
 File "/var/web2py/gluon/main.py", line 403, in wsgibase
   parse_get_post_vars(request, environ)
 File "/var/web2py/gluon/main.py", line 254, in parse_get_post_vars
   request.body = copystream_progress(request) ### stores request body
 File "/var/web2py/gluon/main.py", line 127, in copystream_progress
   copystream(source, dest, size, chunk_size)
 File "/var/web2py/gluon/fileutils.py", line 329, in copystream
   data = src.read(size)
 File "/usr/lib/python2.6/socket.py", line 377, in read
   data = self._sock.recv(left)
 File "/usr/lib/python2.6/ssl.py", line 215, in recv
   return self.read(buflen)
 File "/usr/lib/python2.6/ssl.py", line 136, in read
   return self._sslobj.read(len)
SSLError: The read operation timed out

Server conf : Ubuntu 10.10 64 bits with latest web2py
Client conf : Firefox 3.6.13 on Ubuntu 10.10 32 bits

Help would be appreciated.

Reply via email to