1. cherrypy
  2. CherryPy
Issue #954 duplicate

File uploads under SSL fail with recv error

Anonymous created an issue

Using the wsgiserver, file uploads fail when using HTTPS (SSL), with an error of the form

recv(748) returned 4096 bytes

The exact same file upload works fine when using HTTP (i.e., everything kept the same except for switching to HTTP), so I suspect that SSL is relevant here.

This happens both using the 3.1 wsgiserver, and the latest code from trunk (that has SSL refactored into separate files). The tests were using pyopenssl.

The upload for the test was done using a standard form, from Firefox, {{{ <FORM method=POST ENCTYPE="multipart/form-data"> <p>File to upload: <INPUT TYPE=FILE NAME="file"></p> <INPUT TYPE=SUBMIT VALUE="Continue"> </FORM> }}}

Note that other than this issue, HTTP and HTTPS work fine in this setup (i.e., this isn't a problem with the SSL setup, which works; it is specific to the combination of SSL with file uploads).

P.S. I suspect that this may be the same issue as reported by someone over here:

http://groups.google.com/group/cherrypy-users/browse_thread/thread/2c601a086ef048cc

(SSL isn't suspected as relevant there, but HTTPS is used in the example, and the error is of the same type).

Reported by kripkensteiner@gmail.com

Comments (2)

  1. guest

    Using a programing interface I received a similar behavior.

    Changing wsgiserver/!init!.py SSL_fileobject.recv() to behave like the other methods (sendall, send) not collecting all from the socket, but calling super.recv only once.

    def recv(self, *args, **kwargs):
      return self._safe_call(True, super(SSL_fileobject, self).recv, *args, **kwargs)
    

    Be sure to have a very recent implementation of pyOpenSSL to avoid getting other errors.

    werner.still@hds.com

  2. Log in to comment