owncloud/core — pull request #114 by riso (2012-10-26 21:12:55+00:00)
Title: Implement X-Sendfile support

Well I'm sorry for this third pull reqest but, as I mentioned, I'm not really used to git. This time I created a branch for the feature so that it will be possible to add new commits if it's needed.

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).