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

Implementation for Issue #1244: Allow the specification of multiple directories for fallback_document_root #1257

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

Conversation

jfriesne
Copy link
Contributor

This branch makes the following changes:

  1. Adds new configuration options document_roots and websocket_roots. These serve the same function as the existing document_root and websocket_root, except they allow the user to specify multiple directory-paths, colon-separated, to serve content from. (Under Windows the directory-paths should be semicolon-separated instead, since Windows uses colons in its drive-letter designators)
  2. Deprecated the fallback_document_root and fallback_websocket_root options, since they provide the same functionality as the new options except in a more limited fashion.
  3. Added internal/private function mg_setup_document_roots_vector() which allocates and returns an argv-style NULL-terminated array of path strings based on the specified options. The paths-array will contain the path specified by document_root first (if any), followed by the string specified by fallback_document_root (if any), followed by each of the strings specified by document_roots, followed by a NULL entry. This array is stored as member-variable document_roots in the mg_domain_context class.
  4. Modified the file-path-lookup code to iterate over the document_roots array instead of consulting the config options directly.
  5. Made analogous changes for websocket_roots.
  6. Added internal/private function mg_free_dom() for code that wants to deallocate a mg_domain_context object. This function will take care to deallocate the document_roots and websocket_roots allocations owned by that object as well.
  7. Updated the documentation to include the new keywords.

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.

1 participant