Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: expressjs/serve-favicon
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3d719b0103a56eefecefa199dc622b4ea87b128b
Choose a base ref
...
head repository: expressjs/serve-favicon
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 68b34f5a03ace743e9ae3b0f9b5571e83224bda4
Choose a head ref

Commits on Dec 29, 2015

  1. Copy the full SHA
    968e06a View commit details
  2. Copy the full SHA
    fd4f342 View commit details
  3. build: io.js@2.5

    dougwilson committed Dec 29, 2015
    Copy the full SHA
    b497d93 View commit details
  4. build: support io.js 3.x

    dougwilson committed Dec 29, 2015
    Copy the full SHA
    167d9e2 View commit details
  5. build: support Node.js 4.x

    dougwilson committed Dec 29, 2015
    Copy the full SHA
    abfdcce View commit details
  6. build: istanbul@0.4.1

    dougwilson committed Dec 29, 2015
    Copy the full SHA
    cf9f99b View commit details
  7. build: mocha@2.3.4

    dougwilson committed Dec 29, 2015
    Copy the full SHA
    2ba52d2 View commit details
  8. build: supertest@1.1.0

    dougwilson committed Dec 29, 2015
    Copy the full SHA
    2862ec9 View commit details

Commits on Jan 24, 2016

  1. deps: parseurl@~1.3.1

    dougwilson committed Jan 24, 2016
    Copy the full SHA
    77d3b1d View commit details
  2. build: support Node.js 5.x

    dougwilson committed Jan 24, 2016
    Copy the full SHA
    2f12159 View commit details
  3. build: istanbul@0.4.2

    dougwilson committed Jan 24, 2016
    Copy the full SHA
    70b4f10 View commit details
  4. 2.3.1

    dougwilson committed Jan 24, 2016
    Copy the full SHA
    8be7f2f View commit details

Commits on Apr 13, 2016

  1. build: Node.js@4.4

    dougwilson committed Apr 13, 2016
    Copy the full SHA
    cc52fe7 View commit details
  2. build: Node.js@5.10

    dougwilson committed Apr 13, 2016
    Copy the full SHA
    5b224bf View commit details
  3. Copy the full SHA
    0bc24dd View commit details
  4. build: mocha@2.4.5

    dougwilson committed Apr 13, 2016
    Copy the full SHA
    8527091 View commit details
  5. build: proxyquire@1.4.0

    dougwilson committed Apr 13, 2016
    Copy the full SHA
    1beca7e View commit details

Commits on Aug 8, 2016

  1. build: Node.js@5.12

    dougwilson committed Aug 8, 2016
    Copy the full SHA
    95e9f1c View commit details
  2. build: istanbul@0.4.4

    dougwilson committed Aug 8, 2016
    Copy the full SHA
    1629765 View commit details
  3. build: mocha@2.5.3

    dougwilson committed Aug 8, 2016
    Copy the full SHA
    f76b2e0 View commit details

Commits on Sep 7, 2016

  1. Copy the full SHA
    4c94bae View commit details

Commits on Nov 17, 2016

  1. deps: ms@0.7.2

    dougwilson committed Nov 17, 2016
    Copy the full SHA
    1a5aa03 View commit details
  2. build: Node.js@4.6

    dougwilson committed Nov 17, 2016
    Copy the full SHA
    18e183d View commit details
  3. build: istanbul@0.4.5

    dougwilson committed Nov 17, 2016
    Copy the full SHA
    3897991 View commit details
  4. build: support Node.js 6.x

    dougwilson committed Nov 17, 2016
    Copy the full SHA
    1ee70c3 View commit details
  5. 2.3.2

    dougwilson committed Nov 17, 2016
    Copy the full SHA
    4dafcef View commit details

Commits on Dec 23, 2016

  1. build: Node.js@4.7

    dougwilson committed Dec 23, 2016
    Copy the full SHA
    c54b3ee View commit details
  2. Copy the full SHA
    a8bd991 View commit details

Commits on Dec 28, 2016

  1. Copy the full SHA
    242c838 View commit details

Commits on Jan 30, 2017

  1. build: support Node.js 7.x

    dougwilson committed Jan 30, 2017
    Copy the full SHA
    92d222c View commit details
  2. Copy the full SHA
    42f6966 View commit details

Commits on Feb 15, 2017

  1. build: Node.js@7.5

    dougwilson committed Feb 15, 2017
    Copy the full SHA
    2301e1f View commit details
  2. deps: fresh@0.4.0

    dougwilson committed Feb 15, 2017
    Copy the full SHA
    f91ae78 View commit details

Commits on Feb 20, 2017

  1. deps: etag@~1.8.0

    dougwilson committed Feb 20, 2017
    Copy the full SHA
    0f44452 View commit details
  2. lint: use standard style

    dougwilson committed Feb 20, 2017
    Copy the full SHA
    92e0a99 View commit details
  3. Copy the full SHA
    4d7024d View commit details
  4. 2.4.0

    dougwilson committed Feb 20, 2017
    Copy the full SHA
    b2073b1 View commit details

Commits on Feb 27, 2017

  1. build: Node.js@4.8

    dougwilson committed Feb 27, 2017
    Copy the full SHA
    ff5c1a2 View commit details
  2. build: Node.js@6.10

    dougwilson committed Feb 27, 2017
    Copy the full SHA
    48661c8 View commit details
  3. build: Node.js@7.6

    dougwilson committed Feb 27, 2017
    Copy the full SHA
    22be71f View commit details
  4. Copy the full SHA
    80de876 View commit details
  5. Copy the full SHA
    9fcab00 View commit details
  6. build: eslint@3.16.1

    dougwilson committed Feb 27, 2017
    Copy the full SHA
    271769c View commit details
  7. deps: fresh@0.5.0

    dougwilson committed Feb 27, 2017
    Copy the full SHA
    1665414 View commit details
  8. Copy the full SHA
    c425d06 View commit details
  9. Copy the full SHA
    644808e View commit details
  10. Copy the full SHA
    c64330e View commit details
  11. Copy the full SHA
    bc7984e View commit details

Commits on Feb 28, 2017

  1. Copy the full SHA
    6963249 View commit details
  2. 2.4.1

    dougwilson committed Feb 28, 2017
    Copy the full SHA
    dc00730 View commit details
Showing with 495 additions and 340 deletions.
  1. +2 −0 .eslintignore
  2. +3 −0 .eslintrc
  3. +1 −0 .gitignore
  4. +26 −5 .travis.yml
  5. +67 −0 HISTORY.md
  6. +2 −2 LICENSE
  7. +35 −28 README.md
  8. +17 −4 appveyor.yml
  9. +103 −69 index.js
  10. +18 −9 package.json
  11. +5 −0 test/.eslintrc
  12. +28 −0 test/support/tempIcon.js
  13. +188 −223 test/test.js
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage
node_modules
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "standard"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
coverage/
node_modules/
npm-debug.log
package-lock.json
31 changes: 26 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -3,10 +3,31 @@ node_js:
- "0.8"
- "0.10"
- "0.12"
- "1.0"
- "1.8"
- "2.0"
- "2.1"
- "2.5"
- "3.3"
- "4.8"
- "5.12"
- "6.11"
- "7.10"
- "8.3"
sudo: false
script: "npm run-script test-ci"
after_script: "npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls"
cache:
directories:
- node_modules
before_install:
# Skip updating shrinkwrap / lock
- "npm config set shrinkwrap false"
# Setup Node.js version-specific dependencies
- "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul"
- "test $(echo $TRAVIS_NODE_VERSION | cut -d. -f1) -ge 4 || npm rm --save-dev $(grep -E '\"eslint\\S*\"' package.json | cut -d'\"' -f2)"
# Update Node.js modules
- "test ! -d node_modules || npm prune"
- "test ! -d node_modules || npm rebuild"
script:
# Run test script, depending on istanbul install
- "test ! -z $(npm -ps ls istanbul) || npm test"
- "test -z $(npm -ps ls istanbul) || npm run-script test-ci"
- "test -z $(npm -ps ls eslint ) || npm run-script lint"
after_script:
- "test -e ./coverage/lcov.info && npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
67 changes: 67 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
2.4.5 / 2017-09-26
==================

* deps: etag@~1.8.1
- perf: replace regular expression with substring
* deps: fresh@0.5.2
- Fix regression matching multiple ETags in `If-None-Match`
- perf: improve `If-None-Match` token parsing

2.4.4 / 2017-09-11
==================

* deps: fresh@0.5.1
- Fix handling of modified headers with invalid dates
- perf: improve ETag match loop
* deps: parseurl@~1.3.2
- perf: reduce overhead for full URLs
- perf: unroll the "fast-path" `RegExp`
* deps: safe-buffer@5.1.1

2.4.3 / 2017-05-16
==================

* Use `safe-buffer` for improved Buffer API
* deps: ms@2.0.0

2.4.2 / 2017-03-24
==================

* deps: ms@1.0.0

2.4.1 / 2017-02-27
==================

* Remove usage of `res._headers` private field
* deps: fresh@0.5.0
- Fix incorrect result when `If-None-Match` has both `*` and ETags
- Fix weak `ETag` matching to match spec
- perf: skip checking modified time if ETag check failed
- perf: skip parsing `If-None-Match` when no `ETag` header
- perf: use `Date.parse` instead of `new Date`

2.4.0 / 2017-02-19
==================

* deps: etag@~1.8.0
- Use SHA1 instead of MD5 for ETag hashing
- Works with FIPS 140-2 OpenSSL configuration
* deps: fresh@0.4.0
- Fix false detection of `no-cache` request directive
- perf: enable strict mode
- perf: hoist regular expressions
- perf: remove duplicate conditional
- perf: remove unnecessary boolean coercions
* perf: simplify initial argument checking

2.3.2 / 2016-11-16
==================

* deps: ms@0.7.2

2.3.1 / 2016-01-23
==================

* deps: parseurl@~1.3.1
- perf: enable strict mode

2.3.0 / 2015-06-13
==================

4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
Copyright (c) 2010 Sencha Inc.
Copyright (c) 2011 LearnBoost
Copyright (c) 2011 TJ Holowaychuk
Copyright (c) 2014-2015 Douglas Christopher Wilson
Copyright (c) 2014-2017 Douglas Christopher Wilson

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -22,4 +22,4 @@ 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.
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
63 changes: 35 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
[![Linux Build][travis-image]][travis-url]
[![Windows Build][appveyor-image]][appveyor-url]
[![Test Coverage][coveralls-image]][coveralls-url]
[![Gittip][gittip-image]][gittip-url]
[![Gratipay][gratipay-image]][gratipay-url]

Node.js middleware for serving a favicon.

@@ -31,8 +31,12 @@ example [serve-static](https://npmjs.org/package/serve-static).

## Install

```bash
npm install serve-favicon
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):

```sh
$ npm install serve-favicon
```

## API
@@ -61,29 +65,31 @@ to avoid processing any other middleware if we already know the request is for
### express

```javascript
var express = require('express');
var favicon = require('serve-favicon');
var express = require('express')
var favicon = require('serve-favicon')
var path = require('path')

var app = express();
app.use(favicon(__dirname + '/public/favicon.ico'));
var app = express()
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')))

// Add your routes here, etc.

app.listen(3000);
app.listen(3000)
```

### connect

```javascript
var connect = require('connect');
var favicon = require('serve-favicon');
var connect = require('connect')
var favicon = require('serve-favicon')
var path = require('path')

var app = connect();
app.use(favicon(__dirname + '/public/favicon.ico'));
var app = connect()
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')))

// Add your middleware here, etc.

app.listen(3000);
app.listen(3000)
```

### vanilla http server
@@ -92,26 +98,27 @@ This middleware can be used anywhere, even outside express/connect. It takes
`req`, `res`, and `callback`.

```javascript
var http = require('http');
var favicon = require('serve-favicon');
var finalhandler = require('finalhandler');
var http = require('http')
var favicon = require('serve-favicon')
var finalhandler = require('finalhandler')
var path = require('path')

var _favicon = favicon(__dirname + '/public/favicon.ico');
var _favicon = favicon(path.join(__dirname, 'public', 'favicon.ico'))

var server = http.createServer(function onRequest(req, res) {
var done = finalhandler(req, res);
var server = http.createServer(function onRequest (req, res) {
var done = finalhandler(req, res)

_favicon(req, res, function onNext(err) {
if (err) return done(err);
_favicon(req, res, function onNext (err) {
if (err) return done(err)

// continue to process the request here, etc.

res.statusCode = 404;
res.end('oops');
});
});
res.statusCode = 404
res.end('oops')
})
})

server.listen(3000);
server.listen(3000)
```

## License
@@ -128,5 +135,5 @@ server.listen(3000);
[coveralls-url]: https://coveralls.io/r/expressjs/serve-favicon?branch=master
[downloads-image]: https://img.shields.io/npm/dm/serve-favicon.svg
[downloads-url]: https://npmjs.org/package/serve-favicon
[gittip-image]: https://img.shields.io/gittip/dougwilson.svg
[gittip-url]: https://www.gittip.com/dougwilson/
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
[gratipay-url]: https://www.gratipay.com/dougwilson/
21 changes: 17 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -3,16 +3,29 @@ environment:
- nodejs_version: "0.8"
- nodejs_version: "0.10"
- nodejs_version: "0.12"
- nodejs_version: "1.0"
- nodejs_version: "1.8"
- nodejs_version: "2.0"
- nodejs_version: "2.1"
- nodejs_version: "2.5"
- nodejs_version: "3.3"
- nodejs_version: "4.8"
- nodejs_version: "5.12"
- nodejs_version: "6.11"
- nodejs_version: "7.10"
- nodejs_version: "8.3"
cache:
- node_modules
install:
- ps: Install-Product node $env:nodejs_version
- npm config set shrinkwrap false
- if "%nodejs_version%" equ "0.8" npm rm --save-dev istanbul
- for /f tokens^=2^ delims^=^" %%m in ('findstr /r /c:"eslint[^ ]" package.json') do call npm rm --save-dev %%m
- if exist node_modules npm prune
- if exist node_modules npm rebuild
- npm install
build: off
test_script:
- node --version
- npm --version
- npm run test-ci
- set npm_test_command=test
- for /f %%l in ('npm -ps ls istanbul') do set npm_test_command=test-ci
- npm run %npm_test_command%
version: "{build}"
Loading