Implementation for Issue #1244: Allow the specification of multiple directories for fallback_document_root #1257
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This branch makes the following changes:
document_roots
andwebsocket_roots
. These serve the same function as the existingdocument_root
andwebsocket_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)fallback_document_root
andfallback_websocket_root
options, since they provide the same functionality as the new options except in a more limited fashion.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 bydocument_root
first (if any), followed by the string specified byfallback_document_root
(if any), followed by each of the strings specified bydocument_roots
, followed by a NULL entry. This array is stored as member-variabledocument_roots
in themg_domain_context
class.document_roots
array instead of consulting theconfig
options directly.websocket_roots
.mg_free_dom()
for code that wants to deallocate amg_domain_context
object. This function will take care to deallocate thedocument_roots
andwebsocket_roots
allocations owned by that object as well.