On 23 June 2010 21:31, Steve Franklin <[email protected]> wrote:
> Hi all,
>
> We are getting an error reported in our apache logs when trying to
> download a large file (the particular file we are accessing is 2.9GB).
> Smaller files are working correctly so it would suggest the issue
> isn't directly an issue with config.
>
> The specific errors reported are;
> [Wed Jun 23 08:38:44 2010] [error] [client <IP ADDRESS>] mod_wsgi
> (pid=13946): Exception occurred within WSGI script '<script>'.,
> referer: <URL>
> [Wed Jun 23 08:38:44 2010] [error] [client <IP ADDRESS>] ValueError:
> invalid content length, referer: <URL>
>
> The config;
> Ubuntu (version 8.04.3 LTS)
> Apache 2.2.8
> django 1.1.1
> mod_wsgi 1.3 (though ive tried 3.2 as well and that didn't help)
> The full blurb... Apache/2.2.8 (Ubuntu) mod_python/3.3.1 Python/2.5.2
> mod_wsgi/3.2 PHP/5.2.4-2ubuntu5.7 with Suhosin-Patch mod_ssl/2.2.8
> OpenSSL/0.9.8
>
> The response itself doesn't contain the file but uses the apache
> module xsendfile to serve the file itself - though it doesnt look to
> be getting that far.
>
> The OS is 32bit, so I would have thought there is a maximum value of
> files we could serve in this manner would be around the 4GB limit.
>
> Any ideas?

Don't set Content-Length response header as mod_xsendfile should set it for you.

At the moment there is a limit of 2GB on responses from mod_wsgi where
Content-Length is supplied in response. The issue for this is:

  http://code.google.com/p/modwsgi/issues/detail?id=62

There are two other ways of doing what you want that don't rely on
mod_xsendfile.

The first is to use wsgi.file_wrapper() extension in WSGI and which
mod_wsgi supports. Again, don't set Content-Length as it will be set
for you.

The second if you are using mod_wsgi daemon mode is to return 200
response and Location header, where Location maps to URL in Apache
that maps to static file. If the files need to be private, one can use
mod_rewrite to block access to the URLs for static files except for
sub request as triggered by Location response.

Graham

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to