add user content moved page

pull/223/head
Fabian Jakobs 2015-10-14 13:31:30 +00:00
rodzic 88c9baaf62
commit 8224fb8c66
1 zmienionych plików z 10 dodań i 4 usunięć

14
node_modules/c9/urls.js wygenerowano vendored
Wyświetl plik

@ -22,6 +22,14 @@ function main(options, imports, register) {
});
}
plugin.getHost = function(req) {
return (req.headers && req.headers.host
|| req.host
|| req.url && req.url.replace(/^https?:\/\/([^/]*).*/, "$1")
|| req
);
};
/**
* Get a desired base URL, given some context.
*
@ -30,10 +38,8 @@ function main(options, imports, register) {
* @param {String} targetBaseUrlPattern The target URL pattern, e.g. https://$DOMAIN
*/
plugin.getBaseUrl = function(req, sourceBaseUrlPattern, targetBaseUrlPattern) {
var sourceHost = req.headers && req.headers.host
|| req.host
|| req.url && req.url.replace(/^https?:\/\/([^/]*).*/, "$1")
|| req;
var sourceHost = plugin.getHost(req);
if (typeof sourceHost !== "string")
throw new Error("Not a valid request object: " + req);
if (!sourceBaseUrlPattern)