mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
0af3c38b32
|
@ -813,6 +813,15 @@ should win in this case:
|
|||
]
|
||||
});
|
||||
|
||||
If you call `next()`, the next specific routing will be used for the
|
||||
original URL. Even if you modify the URL in the request object `req`,
|
||||
this will not cause the `next()` to jump to the routing defined for
|
||||
this next URL. If proceeds occurding the origin URL. However, if you
|
||||
use `next(true)`, the routing will stop and request handling is
|
||||
started with the new URL. You must ensure that `next(true)` is never
|
||||
called without modifying the URL in the request object
|
||||
`req`. Otherwise an endless loop will occur.
|
||||
|
||||
Application Deployment{#UserManualActionsApplicationDeployment}
|
||||
===============================================================
|
||||
|
||||
|
|
|
@ -961,9 +961,15 @@ function routeRequest (req, res) {
|
|||
}
|
||||
};
|
||||
|
||||
next = function () {
|
||||
next = function (restart) {
|
||||
action = exports.nextRouting(action);
|
||||
|
||||
if (restart) {
|
||||
routeRequest(req, res);
|
||||
}
|
||||
else {
|
||||
execute();
|
||||
}
|
||||
};
|
||||
|
||||
execute();
|
||||
|
@ -1969,6 +1975,31 @@ function redirectRequest (req, res, options, next) {
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief rewrites a request
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function rewriteRequest (req, res, options, next) {
|
||||
'use strict';
|
||||
|
||||
var i = 0;
|
||||
var suffix = options.destination.split("/");
|
||||
|
||||
for (i = 0; i < suffix.length; ++i) {
|
||||
if (suffix[i] !== "") {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < i) {
|
||||
suffix = suffix.splice(i);
|
||||
}
|
||||
|
||||
req.suffix = suffix;
|
||||
|
||||
next(true);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief redirects a request
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2093,6 +2124,7 @@ exports.easyPostCallback = easyPostCallback;
|
|||
exports.echoRequest = echoRequest;
|
||||
exports.logRequest = logRequest;
|
||||
exports.redirectRequest = redirectRequest;
|
||||
exports.rewriteRequest = rewriteRequest;
|
||||
exports.pathHandler = pathHandler;
|
||||
|
||||
// some useful constants
|
||||
|
|
Loading…
Reference in New Issue