Repository navigation
Let the application answer the root path / itself [#740] - #745
Open
ambroise-leclerc wants to merge 2 commits into
Open
ambroise-leclerc wants to merge 2 commits into
ambroise-leclerc wants to merge 2 commits into
Conversation
Response::StatusCode gains found, seeOther, temporaryRedirect and permanentRedirect, written with their reason phrase. http::redirectReply(status, location) builds a route reply with Location, an empty body and, for the temporary ones, Cache-Control: no-store; it refuses a status that is not a redirection and a location that is empty or holds a control character.
app.addRootRoute(handler) registers a route that answers the path / alone, with any query, before the file providers that would serve the document root's index.html. Every other path keeps its routing, and under a family of spaces /s/<id>/ still serves index.html: the root route belongs to the application, not to the spaces. A session lobby can thus redirect / to a new session with a 303 in one step.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #740.
Based on #743 (#741): the root route's tests and the lobby example use
http::redirectReplyandResponse::seeOther. Merge #743 first; this PR's own change is its last commit.Changes
app.addRootRoute(handler[, options])(andhttp::Server::addRootRoute,RouteTable::addRoot): a route that answers the path/alone, any query included, forGETandHEAD(andPOSTwithpostBodyLimit), before the file providers that would serve the document root'sindex.html. The forms the server reads as/(//,/./) are included, as they would have servedindex.html./index.html,/other/, the prefix routes, the mounts. A prefix route still cannot be/./s/<id>/still servesindex.html: the root route belongs to the application, somatchRouteskips it for a mounted request.std::invalid_argument), as for overlapping prefixes;secretPathis refused; the registration removes it.docs/HTTP_ASSETS.mdanddocs/SPACES.md(new section "A session lobby"); changelog entry.Tests
The root route answers / alone, and the root of a space keeps its index.html (#740):GET /,/?from=link,//and/./reach the route (303 withLocation);HEAD /too;POST /gets 405;/index.htmland/other/are served by the providers;/s/abc/under a mount servesindex.html; afterreset()and without a root route/servesindex.html; a second root route, an empty handler and a secret root are refused; prefix routes coexist.CEF-off build and full CTest suite: 771/771 passed (the CUDA case skipped).