owncloud/core — pull request #34 by riso (2012-10-15 17:31:32+00:00)
Title: Implement X-Sendfile support (resubmit)

I fixed the commit history rebasing everything into this single commit. I hope this time is OK, i'm quite new to git.

This closes Enhancement oc-1835.

The solution I implemented to provide support for X-Sendfile / X-Accel-Redirect adds the header to the request only if the web server advertise its support for them and only for a local filestorage.

This means that it is necessary, if X-Sendfile support is wanted, to specify:

* nginx: fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on
* Apache: SetEnv MOD_X_SENDFILE_ENABLED 1
and by properly configuring the paths accessible by the web-server.

The same should be achievable in lighttpd (I haven't tested it).

The use of environment variables prevents the headers from being set if not explicitly wanted.
This way admins that don't want to dig into this configuration will still benefit from the classic file transfer provided by the readfile function.

This also makes possible to set only the correct header for the used web server, preventing both headers from being set (which would make the absolute path to the requested resource visible to the user since only the used header is stripped while the other would be left untouched).