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 given Content-Length did not match number of body bytes read
[error] (70014)End of file found: proxy: pass request body failed to ( from ()

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