Revert "Changements dans les modules (nouvelle version Express, mysql, ..)"

This reverts commit bdab795506.
This commit is contained in:
2023-11-23 16:13:50 +01:00
parent 756f928ced
commit 5b0d68d66f
818 changed files with 35968 additions and 82263 deletions

41
node_modules/serve-static/index.js generated vendored
View File

@@ -2,7 +2,7 @@
* serve-static
* Copyright(c) 2010 Sencha Inc.
* Copyright(c) 2011 TJ Holowaychuk
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* Copyright(c) 2014-2016 Douglas Christopher Wilson
* MIT Licensed
*/
@@ -13,6 +13,7 @@
* @private
*/
var encodeUrl = require('encodeurl')
var escapeHtml = require('escape-html')
var parseUrl = require('parseurl')
var resolve = require('path').resolve
@@ -131,7 +132,7 @@ function serveStatic (root, options) {
*/
function collapseLeadingSlashes (str) {
for (var i = 0; i < str.length; i++) {
if (str[i] !== '/') {
if (str.charCodeAt(i) !== 0x2f /* / */) {
break
}
}
@@ -141,6 +142,27 @@ function collapseLeadingSlashes (str) {
: str
}
/**
* Create a minimal HTML document.
*
* @param {string} title
* @param {string} body
* @private
*/
function createHtmlDocument (title, body) {
return '<!DOCTYPE html>\n' +
'<html lang="en">\n' +
'<head>\n' +
'<meta charset="utf-8">\n' +
'<title>' + title + '</title>\n' +
'</head>\n' +
'<body>\n' +
'<pre>' + body + '</pre>\n' +
'</body>\n' +
'</html>\n'
}
/**
* Create a directory listener that just 404s.
* @private
@@ -158,7 +180,7 @@ function createNotFoundDirectoryListener () {
*/
function createRedirectDirectoryListener () {
return function redirect () {
return function redirect (res) {
if (this.hasTrailingSlash()) {
this.error(404)
return
@@ -172,16 +194,17 @@ function createRedirectDirectoryListener () {
originalUrl.pathname = collapseLeadingSlashes(originalUrl.pathname + '/')
// reformat the URL
var loc = url.format(originalUrl)
var msg = 'Redirecting to <a href="' + escapeHtml(loc) + '">' + escapeHtml(loc) + '</a>\n'
var res = this.res
var loc = encodeUrl(url.format(originalUrl))
var doc = createHtmlDocument('Redirecting', 'Redirecting to <a href="' + escapeHtml(loc) + '">' +
escapeHtml(loc) + '</a>')
// send redirect response
res.statusCode = 303
res.statusCode = 301
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
res.setHeader('Content-Length', Buffer.byteLength(msg))
res.setHeader('Content-Length', Buffer.byteLength(doc))
res.setHeader('Content-Security-Policy', "default-src 'none'")
res.setHeader('X-Content-Type-Options', 'nosniff')
res.setHeader('Location', loc)
res.end(msg)
res.end(doc)
}
}