Firebase Update

This commit is contained in:
Lukas Nowy
2018-12-22 23:30:39 +01:00
parent befb44764d
commit acffe619b3
11523 changed files with 1614327 additions and 930246 deletions

View File

@ -1,3 +1,29 @@
0.16.2 / 2018-02-07
===================
* Fix incorrect end tag in default error & redirects
* deps: depd@~1.1.2
- perf: remove argument reassignment
* deps: encodeurl@~1.0.2
- Fix encoding `%` as last character
* deps: statuses@~1.4.0
0.16.1 / 2017-09-29
===================
* Fix regression in edge-case behavior for empty `path`
0.16.0 / 2017-09-27
===================
* Add `immutable` option
* Fix missing `</html>` in default error & redirects
* Use instance methods on steam to check for listeners
* deps: mime@1.4.1
- Add 70 new types for file extensions
- Set charset as "UTF-8" for .js and .json
* perf: improve path validation speed
0.15.6 / 2017-09-22
===================

View File

@ -5,7 +5,6 @@
[![Linux Build][travis-image]][travis-url]
[![Windows Build][appveyor-image]][appveyor-url]
[![Test Coverage][coveralls-image]][coveralls-url]
[![Gratipay][gratipay-image]][gratipay-url]
Send is a library for streaming files from the file system as a http response
supporting partial responses (Ranges), conditional-GET negotiation (If-Match,
@ -50,7 +49,7 @@ of the `Range` request header.
##### cacheControl
Enable or disable setting `Cache-Control` response header, defaults to
true. Disabling this will ignore the `maxAge` option.
true. Disabling this will ignore the `immutable` and `maxAge` options.
##### dotfiles
@ -86,6 +85,14 @@ in the given order. By default, this is disabled (set to `false`). An
example value that will serve extension-less HTML files: `['html', 'htm']`.
This is skipped if the requested file already has an extension.
##### immutable
Enable or diable the `immutable` directive in the `Cache-Control` response
header, defaults to `false`. If set to `true`, the `maxAge` option should
also be specified to enable caching. The `immutable` directive will prevent
supported clients from making conditional requests during the life of the
`maxAge` option to check if the file has changed.
##### index
By default send supports "index.html" files, to disable this
@ -297,5 +304,3 @@ server.listen(3000)
[coveralls-url]: https://coveralls.io/r/pillarjs/send?branch=master
[downloads-image]: https://img.shields.io/npm/dm/send.svg
[downloads-url]: https://npmjs.org/package/send
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
[gratipay-url]: https://www.gratipay.com/dougwilson/

View File

@ -19,7 +19,6 @@ var destroy = require('destroy')
var encodeUrl = require('encodeurl')
var escapeHtml = require('escape-html')
var etag = require('etag')
var EventEmitter = require('events').EventEmitter
var fresh = require('fresh')
var fs = require('fs')
var mime = require('mime')
@ -71,14 +70,6 @@ var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/
module.exports = send
module.exports.mime = mime
/**
* Shim EventEmitter.listenerCount for node.js < 0.10
*/
/* istanbul ignore next */
var listenerCount = EventEmitter.listenerCount ||
function (emitter, type) { return emitter.listeners(type).length }
/**
* Return a `SendStream` for `req` and `path`.
*
@ -146,6 +137,10 @@ function SendStream (req, path, options) {
? normalizeList(opts.extensions, 'extensions option')
: []
this._immutable = opts.immutable !== undefined
? Boolean(opts.immutable)
: false
this._index = opts.index !== undefined
? normalizeList(opts.index, 'index option')
: ['index.html']
@ -271,7 +266,7 @@ SendStream.prototype.maxage = deprecate.function(function maxage (maxAge) {
SendStream.prototype.error = function error (status, err) {
// emit if listeners instead of responding
if (listenerCount(this, 'error') !== 0) {
if (hasListeners(this, 'error')) {
return this.emit('error', createError(status, err, {
expose: false
}))
@ -480,7 +475,7 @@ SendStream.prototype.isRangeFresh = function isRangeFresh () {
SendStream.prototype.redirect = function redirect (path) {
var res = this.res
if (listenerCount(this, 'directory') !== 0) {
if (hasListeners(this, 'directory')) {
this.emit('directory', res, path)
return
}
@ -534,19 +529,24 @@ SendStream.prototype.pipe = function pipe (res) {
var parts
if (root !== null) {
// normalize
if (path) {
path = normalize('.' + sep + path)
}
// malicious path
if (UP_PATH_REGEXP.test(normalize('.' + sep + path))) {
if (UP_PATH_REGEXP.test(path)) {
debug('malicious path "%s"', path)
this.error(403)
return res
}
// explode path parts
parts = path.split(sep)
// join / normalize from optional root dir
path = normalize(join(root, path))
root = normalize(root + sep)
// explode path parts
parts = path.substr(root.length).split(sep)
} else {
// ".." is malicious without "root"
if (UP_PATH_REGEXP.test(path)) {
@ -870,6 +870,11 @@ SendStream.prototype.setHeader = function setHeader (path, stat) {
if (this._cacheControl && !res.getHeader('Cache-Control')) {
var cacheControl = 'public, max-age=' + Math.floor(this._maxage / 1000)
if (this._immutable) {
cacheControl += ', immutable'
}
debug('cache-control %s', cacheControl)
res.setHeader('Cache-Control', cacheControl)
}
@ -928,7 +933,8 @@ function collapseLeadingSlashes (str) {
function containsDotFile (parts) {
for (var i = 0; i < parts.length; i++) {
if (parts[i][0] === '.') {
var part = parts[i]
if (part.length > 1 && part[0] === '.') {
return true
}
}
@ -965,7 +971,8 @@ function createHtmlDocument (title, body) {
'</head>\n' +
'<body>\n' +
'<pre>' + body + '</pre>\n' +
'</body>\n'
'</body>\n' +
'</html>\n'
}
/**
@ -1000,6 +1007,26 @@ function getHeaderNames (res) {
: res.getHeaderNames()
}
/**
* Determine if emitter has listeners of a given type.
*
* The way to do this check is done three different ways in Node.js >= 0.8
* so this consolidates them into a minimal set using instance methods.
*
* @param {EventEmitter} emitter
* @param {string} type
* @returns {boolean}
* @private
*/
function hasListeners (emitter, type) {
var count = typeof emitter.listenerCount !== 'function'
? emitter.listeners(type).length
: emitter.listenerCount(type)
return count > 0
}
/**
* Determine if the response headers have been sent.
*

View File

@ -1,55 +0,0 @@
1.3.1 / 2016-11-11
==================
* Fix return type in JSDoc
1.3.0 / 2016-05-17
==================
* Add `421 Misdirected Request`
* perf: enable strict mode
1.2.1 / 2015-02-01
==================
* Fix message for status 451
- `451 Unavailable For Legal Reasons`
1.2.0 / 2014-09-28
==================
* Add `208 Already Repored`
* Add `226 IM Used`
* Add `306 (Unused)`
* Add `415 Unable For Legal Reasons`
* Add `508 Loop Detected`
1.1.1 / 2014-09-24
==================
* Add missing 308 to `codes.json`
1.1.0 / 2014-09-21
==================
* Add `codes.json` for universal support
1.0.4 / 2014-08-20
==================
* Package cleanup
1.0.3 / 2014-06-08
==================
* Add 308 to `.redirect` category
1.0.2 / 2014-03-13
==================
* Add `.retry` category
1.0.1 / 2014-03-12
==================
* Initial release

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
Copyright (c) 2016 Douglas Christopher Wilson doug@somethingdoug.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,103 +0,0 @@
# Statuses
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
HTTP status utility for node.
## API
```js
var status = require('statuses')
```
### var code = status(Integer || String)
If `Integer` or `String` is a valid HTTP code or status message, then the appropriate `code` will be returned. Otherwise, an error will be thrown.
```js
status(403) // => 403
status('403') // => 403
status('forbidden') // => 403
status('Forbidden') // => 403
status(306) // throws, as it's not supported by node.js
```
### status.codes
Returns an array of all the status codes as `Integer`s.
### var msg = status[code]
Map of `code` to `status message`. `undefined` for invalid `code`s.
```js
status[404] // => 'Not Found'
```
### var code = status[msg]
Map of `status message` to `code`. `msg` can either be title-cased or lower-cased. `undefined` for invalid `status message`s.
```js
status['not found'] // => 404
status['Not Found'] // => 404
```
### status.redirect[code]
Returns `true` if a status code is a valid redirect status.
```js
status.redirect[200] // => undefined
status.redirect[301] // => true
```
### status.empty[code]
Returns `true` if a status code expects an empty body.
```js
status.empty[200] // => undefined
status.empty[204] // => true
status.empty[304] // => true
```
### status.retry[code]
Returns `true` if you should retry the rest.
```js
status.retry[501] // => undefined
status.retry[503] // => true
```
## Adding Status Codes
The status codes are primarily sourced from http://www.iana.org/assignments/http-status-codes/http-status-codes-1.csv.
Additionally, custom codes are added from http://en.wikipedia.org/wiki/List_of_HTTP_status_codes.
These are added manually in the `lib/*.json` files.
If you would like to add a status code, add it to the appropriate JSON file.
To rebuild `codes.json`, run the following:
```bash
# update src/iana.json
npm run fetch
# build codes.json
npm run build
```
[npm-image]: https://img.shields.io/npm/v/statuses.svg
[npm-url]: https://npmjs.org/package/statuses
[node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg
[node-version-url]: https://nodejs.org/en/download
[travis-image]: https://img.shields.io/travis/jshttp/statuses.svg
[travis-url]: https://travis-ci.org/jshttp/statuses
[coveralls-image]: https://img.shields.io/coveralls/jshttp/statuses.svg
[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master
[downloads-image]: https://img.shields.io/npm/dm/statuses.svg
[downloads-url]: https://npmjs.org/package/statuses

View File

@ -1,65 +0,0 @@
{
"100": "Continue",
"101": "Switching Protocols",
"102": "Processing",
"200": "OK",
"201": "Created",
"202": "Accepted",
"203": "Non-Authoritative Information",
"204": "No Content",
"205": "Reset Content",
"206": "Partial Content",
"207": "Multi-Status",
"208": "Already Reported",
"226": "IM Used",
"300": "Multiple Choices",
"301": "Moved Permanently",
"302": "Found",
"303": "See Other",
"304": "Not Modified",
"305": "Use Proxy",
"306": "(Unused)",
"307": "Temporary Redirect",
"308": "Permanent Redirect",
"400": "Bad Request",
"401": "Unauthorized",
"402": "Payment Required",
"403": "Forbidden",
"404": "Not Found",
"405": "Method Not Allowed",
"406": "Not Acceptable",
"407": "Proxy Authentication Required",
"408": "Request Timeout",
"409": "Conflict",
"410": "Gone",
"411": "Length Required",
"412": "Precondition Failed",
"413": "Payload Too Large",
"414": "URI Too Long",
"415": "Unsupported Media Type",
"416": "Range Not Satisfiable",
"417": "Expectation Failed",
"418": "I'm a teapot",
"421": "Misdirected Request",
"422": "Unprocessable Entity",
"423": "Locked",
"424": "Failed Dependency",
"425": "Unordered Collection",
"426": "Upgrade Required",
"428": "Precondition Required",
"429": "Too Many Requests",
"431": "Request Header Fields Too Large",
"451": "Unavailable For Legal Reasons",
"500": "Internal Server Error",
"501": "Not Implemented",
"502": "Bad Gateway",
"503": "Service Unavailable",
"504": "Gateway Timeout",
"505": "HTTP Version Not Supported",
"506": "Variant Also Negotiates",
"507": "Insufficient Storage",
"508": "Loop Detected",
"509": "Bandwidth Limit Exceeded",
"510": "Not Extended",
"511": "Network Authentication Required"
}

View File

@ -1,110 +0,0 @@
/*!
* statuses
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module dependencies.
* @private
*/
var codes = require('./codes.json')
/**
* Module exports.
* @public
*/
module.exports = status
// array of status codes
status.codes = populateStatusesMap(status, codes)
// status codes for redirects
status.redirect = {
300: true,
301: true,
302: true,
303: true,
305: true,
307: true,
308: true
}
// status codes for empty bodies
status.empty = {
204: true,
205: true,
304: true
}
// status codes for when you should retry the request
status.retry = {
502: true,
503: true,
504: true
}
/**
* Populate the statuses map for given codes.
* @private
*/
function populateStatusesMap (statuses, codes) {
var arr = []
Object.keys(codes).forEach(function forEachCode (code) {
var message = codes[code]
var status = Number(code)
// Populate properties
statuses[status] = message
statuses[message] = status
statuses[message.toLowerCase()] = status
// Add to array
arr.push(status)
})
return arr
}
/**
* Get the status code.
*
* Given a number, this will throw if it is not a known status
* code, otherwise the code will be returned. Given a string,
* the string will be parsed for a number and return the code
* if valid, otherwise will lookup the code assuming this is
* the status message.
*
* @param {string|number} code
* @returns {number}
* @public
*/
function status (code) {
if (typeof code === 'number') {
if (!status[code]) throw new Error('invalid status code: ' + code)
return code
}
if (typeof code !== 'string') {
throw new TypeError('code must be a number or string')
}
// '403'
var n = parseInt(code, 10)
if (!isNaN(n)) {
if (!status[n]) throw new Error('invalid status code: ' + n)
return n
}
n = status[code.toLowerCase()]
if (!n) throw new Error('invalid status message: "' + code + '"')
return n
}

View File

@ -1,83 +0,0 @@
{
"_from": "statuses@~1.3.1",
"_id": "statuses@1.3.1",
"_inBundle": false,
"_integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=",
"_location": "/send/statuses",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "statuses@~1.3.1",
"name": "statuses",
"escapedName": "statuses",
"rawSpec": "~1.3.1",
"saveSpec": null,
"fetchSpec": "~1.3.1"
},
"_requiredBy": [
"/send"
],
"_resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz",
"_shasum": "faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e",
"_spec": "statuses@~1.3.1",
"_where": "D:\\5CHITM\\Diplomarbeit\\smart-shopper\\express-server\\node_modules\\send",
"bugs": {
"url": "https://github.com/jshttp/statuses/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
},
{
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
}
],
"deprecated": false,
"description": "HTTP status utility",
"devDependencies": {
"csv-parse": "1.1.7",
"eslint": "3.10.0",
"eslint-config-standard": "6.2.1",
"eslint-plugin-promise": "3.3.2",
"eslint-plugin-standard": "2.0.1",
"istanbul": "0.4.5",
"mocha": "1.21.5",
"stream-to-array": "2.3.0"
},
"engines": {
"node": ">= 0.6"
},
"files": [
"HISTORY.md",
"index.js",
"codes.json",
"LICENSE"
],
"homepage": "https://github.com/jshttp/statuses#readme",
"keywords": [
"http",
"status",
"code"
],
"license": "MIT",
"name": "statuses",
"repository": {
"type": "git",
"url": "git+https://github.com/jshttp/statuses.git"
},
"scripts": {
"build": "node scripts/build.js",
"fetch": "node scripts/fetch.js",
"lint": "eslint .",
"test": "mocha --reporter spec --check-leaks --bail test/",
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
"update": "npm run fetch && npm run build"
},
"version": "1.3.1"
}

View File

@ -1,28 +1,28 @@
{
"_from": "send@0.15.6",
"_id": "send@0.15.6",
"_from": "send@0.16.2",
"_id": "send@0.16.2",
"_inBundle": false,
"_integrity": "sha1-IPI6nJJbdiq4JwX+L52yUqzkfjQ=",
"_integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==",
"_location": "/send",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "send@0.15.6",
"raw": "send@0.16.2",
"name": "send",
"escapedName": "send",
"rawSpec": "0.15.6",
"rawSpec": "0.16.2",
"saveSpec": null,
"fetchSpec": "0.15.6"
"fetchSpec": "0.16.2"
},
"_requiredBy": [
"/express",
"/serve-static"
],
"_resolved": "https://registry.npmjs.org/send/-/send-0.15.6.tgz",
"_shasum": "20f23a9c925b762ab82705fe2f9db252ace47e34",
"_spec": "send@0.15.6",
"_where": "D:\\5CHITM\\Diplomarbeit\\smart-shopper\\express-server\\node_modules\\express",
"_resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz",
"_shasum": "6ecca1e0f8c156d141597559848df64730a6bbc1",
"_spec": "send@0.16.2",
"_where": "D:\\Desktop\\smartshopperNodeReworkFirebase\\node_modules\\express",
"author": {
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca"
@ -47,28 +47,30 @@
],
"dependencies": {
"debug": "2.6.9",
"depd": "~1.1.1",
"depd": "~1.1.2",
"destroy": "~1.0.4",
"encodeurl": "~1.0.1",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "~1.6.2",
"mime": "1.3.4",
"mime": "1.4.1",
"ms": "2.0.0",
"on-finished": "~2.3.0",
"range-parser": "~1.2.0",
"statuses": "~1.3.1"
"statuses": "~1.4.0"
},
"deprecated": false,
"description": "Better streaming static file server with Range and conditional-GET support",
"devDependencies": {
"after": "0.8.2",
"eslint": "3.19.0",
"eslint-config-standard": "7.1.0",
"eslint-config-standard": "10.2.1",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-markdown": "1.0.0-beta.6",
"eslint-plugin-promise": "3.5.0",
"eslint-plugin-standard": "2.3.1",
"eslint-plugin-node": "5.2.1",
"eslint-plugin-promise": "3.6.0",
"eslint-plugin-standard": "3.0.1",
"istanbul": "0.4.5",
"mocha": "2.5.3",
"supertest": "1.1.0"
@ -100,5 +102,5 @@
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot"
},
"version": "0.15.6"
"version": "0.16.2"
}