Every 3rd Safari Upload Fails

CherryPy Logo

Recently I built a small CherryPy application to allow users to upload photos to a gallery. The application is pretty trivial and just uses the Python Imaging Library to resize the photos and Genshi to output some XML which is used by a Flash gallery.

However, after deployment a user complained every 3rd upload would fail. She was using Safari on Mac OSX, and I couldn’t duplicate the error in Firefox. Luckily she didn’t mind switching to Firefox and it fixed her problem:

Working with Firefox has helped tremendously! I’ll only use it from now on, and we should be fine with uploads.

Has anyone else seen this? I deployed CherryPy behind Apache 2.2 using mod_proxy, and Apache logs the following error when an upload fails (IPs changed):

[error] proxy: client 000.000.000.000 given Content-Length did not match number of body bytes read
[error] (70014)End of file found: proxy: pass request body failed to 127.0.0.1:9595 (127.0.0.1) from 00.000.000.001 ()

So it appears Safari just messes up the Content-Length. All CherryPy would receive is a POST with no data.

This entry was posted in Python, Technology and tagged , , . Bookmark the permalink.
  • john speno

    It’s probably helpful if you provide the versions of Safari and/or MacOS X. I’m not saying I have any idea what the problem is however. ;-)

  • http://michael.susens-schurter.com/blog/ Michael Schurter

    @john speno:
    I wish I knew! Since when does your average end user include useful info like that though? Here’s what was included in the bug report:
    “She uses Safari 2.4.0 on a Mac.”
    Now I’m pretty sure 2.4.0 doesn’t exist, so I’m guessing its 2.0.4.

  • Mitch Chapman

    I don’t know if this is relevant to your problem, but it worked for me: I had my upload form’s target window set to an iframe with a CSS style of ‘display:hidden’. Every upload attempt timed out, when using Safari. Firefox worked fine.

    After changing the style so the iframe was simply positioned off-screen, I was able to upload from Safari.

    The inspiration to try a positioned, rather than a hidden, iframe, came from http-dash-dash-www.webmasterworld.com-dash-macintosh_webmaster-dash-3341383.htm .