HN44 / pywebdav

Automatically exported from code.google.com/p/pywebdav
0 stars 0 forks source link

Streaming a PUT request #50

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. send a big file (more then 100mb) with a PUT request (using python requests 
module)

What is the expected output? What do you see instead?

expected is that the file will find it's merry way into the webdav server

What version of the product are you using? On what operating system?
I'm using python2.7 on winXP

Please provide any additional information below.

this is the log + backtrace:

2012-06-13 23:45:30,171 DEBUG do_PUT: uri = 
http://127.0.0.1:8008/webdav/xstreaming/CH2/0001_WildPuzzleROM_v0.8
.zip
2012-06-13 23:45:30,171 DEBUG do_PUT: headers = Host: 127.0.0.1:8008
Content-Length: 132463603
Accept-Encoding: identity, deflate, compress, gzip
Accept: */*
User-agent: SSP-IP
Depth: infinity
Cache-control: no-cache
Content-Type: multipart/form-data; 
boundary=138.134.121.23.1.5668.1339620329.109.1

2012-06-13 23:45:30,171 DEBUG do_PUT: Content-Length = 132463603
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 2621)
Traceback (most recent call last):
  File "c:\Python27\lib\SocketServer.py", line 582, in process_request_thread
    self.finish_request(request, client_address)
  File "c:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "c:\Python27\lib\SocketServer.py", line 639, in __init__
    self.handle()
  File "c:\Python27\lib\BaseHTTPServer.py", line 337, in handle
    self.handle_one_request()
  File "c:\Python27\lib\BaseHTTPServer.py", line 325, in handle_one_request
    method()
  File "c:\Python27\lib\site-packages\pywebdav\lib\WebDAVServer.py", line 591, in do_PUT
    body = self._readNoChunkedData(atoi(l))
  File "c:\Python27\lib\site-packages\pywebdav\lib\WebDAVServer.py", line 617, in _readNoChunkedData
    return self.__readNoChunkedDataWithoutIterator(content_length)
  File "c:\Python27\lib\site-packages\pywebdav\lib\WebDAVServer.py", line 631, in __readNoChunkedDataWithoutIte
rator
    return self.rfile.read(content_length)
  File "c:\Python27\lib\socket.py", line 378, in read
    data = self._sock.recv(left)
error: [Errno 10055] An operation on a socket could not be performed because 
the system lacked sufficient buffe
r space or because a queue was full
----------------------------------------

my guess is that PyWebDev is trying to read all the 132463603 byte in one recv, 
which isn't possible.

files that big should be streamed, chunk by chunk.

after fiddling with the code, I've found out I need to setup the server to 
HTTP1.1, which wasn't clear and wasn't on the command line options...

when I turn it on I got this trace back on any file I tried PUTting:

Exception happened during processing of request from ('127.0.0.1', 3438)
Traceback (most recent call last):
  File "c:\Python27\lib\SocketServer.py", line 582, in process_request_thread
    self.finish_request(request, client_address)
  File "c:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "c:\Python27\lib\SocketServer.py", line 639, in __init__
    self.handle()
  File "c:\Python27\lib\BaseHTTPServer.py", line 337, in handle
    self.handle_one_request()
  File "c:\Python27\lib\BaseHTTPServer.py", line 325, in handle_one_request
    method()
  File "c:\Python27\lib\site-packages\pywebdav\lib\WebDAVServer.py", line 584, in do_PUT
    dc.put(uri, self._readChunkedData(), content_type)
  File "c:\Python27\lib\site-packages\pywebdav\server\fshandler.py", line 259, in put
    raise DAV_Error, 424
DAV_Error: (424, '')
----------------------------------------

after  adding some debug I found out the _readChunkedData is actually using 
http://en.wikipedia.org/wiki/Chunked_transfer_encoding

isn't there anther way of streaming big files into PyWebDAV ?

Original issue reported on code.google.com by israel.fruchter on 13 Jun 2012 at 10:23