Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correction of 'XSendFilePath' configuration behavior. #46

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

alexsilva
Copy link

XSendFileRootPath - I created a new configuration that allows you to change the root path (this is important for non-standard installations).

As the test environment was windows I added the file 'CMakeLists.txt' to work with clion + cmake + vc17 with apache2 lounge.

The main fix is the behavior of the 'XSendFilePath' configuration that was not in accordance with the documentation.

Config:

Root: /var/www
XSendFilePath: /tmp/videos

Given a relative file via header for the module, for example 'file.mp4', the result was always the directory /var/www/file.mp4. XSendFile Path was being ignored because the existence of the file in the root directory was not verified.

The code snippet below solves the problem because if the file does not exist in the root directory, it will be checked in the next directory that is XSendFile.

        // The path is only valid if it exists.
        // If it doesn't continue until you find a valid path on the white-list.
        apr_finfo_t info;
        rv = apr_stat(&info, *path, APR_FINFO_CSIZE, r->pool);
        if (rv == OK) {
            break;
        } else {
            continue;
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant