Comparing version 1.3.1 to 1.4.0
@@ -0,1 +1,6 @@ | ||
2015/12/22 Version 1.4.0 | ||
- Add ability to specify custom mimetypes via a JSON blob (on the CLI) | ||
- Started test suite around CLI options parsing | ||
- Workaround for egregious v8 bug around date parsing throwing during modified-since checks | ||
2015/11/15 Version 1.3.1 | ||
@@ -2,0 +7,0 @@ - Add recent contributors to CONTRIBUTORS.md |
@@ -19,2 +19,53 @@ # Contributing Guidelines | ||
## Windows Users | ||
Before you clone ecstatic you unfortunately have to configure git to not pull | ||
certain files. | ||
The test suite has a | ||
[test](https://github.com/jfhbrook/node-ecstatic/blob/master/test/showdir-pathname-encoding.js#L28-L29) | ||
for proper HTML entities encoding which depends on a character which is | ||
[illegal in Windows](https://github.com/jfhbrook/node-ecstatic/issues/172). | ||
This breaks `git clone` in Windows. | ||
Until someone has an epiphany and thinks up of a character which is acceptable | ||
on multiple platforms and effectively tests this behavior, here's how to get | ||
around it: | ||
1) Create and initialize your new repository (`<url>` is your fork): | ||
```bash | ||
mkdir node-ecstatic | ||
cd node-ecstatic | ||
git init | ||
git remote add –f origin <url> | ||
``` | ||
2) Enable sparse-checkout: | ||
```bash | ||
git config core.sparsecheckout true | ||
``` | ||
3) Configure sparse-checkout by listing your desired and excluded sub-trees | ||
in .git/info/sparse-checkout (paste this into notepad): | ||
```winbatch | ||
/* | ||
!test/public/<dir> | ||
!test/showdir-search-encoding.js | ||
!test/showdir-pathname-encoding.js | ||
``` | ||
This configures git to pull everything but the offending directory and tests which depend on it being there. | ||
4) Checkout from the remote: | ||
```bash | ||
git pull origin master | ||
``` | ||
You can read all the details about sparse-checkout in the | ||
[git documentation](https://git-scm.com/docs/git-read-tree#_sparse_checkout). | ||
## Branching | ||
@@ -21,0 +72,0 @@ |
@@ -57,1 +57,2 @@ General format is: contributor, github handle, email. In some cases, the | ||
* Cam Wiegert @camwiegert <cam@camwiegert.com> | ||
* Josh Gillies @joshgillies <github@joshgilli.es> |
@@ -39,2 +39,6 @@ #! /usr/bin/env node | ||
if (opts.mimeTypes) { | ||
try { | ||
// You can pass a JSON blob here---useful for CLI use | ||
opts.mimeTypes = JSON.parse(opts.mimeTypes); | ||
} catch (e) {} | ||
if (typeof opts.mimeTypes === 'string') { | ||
@@ -280,5 +284,17 @@ mime.load(opts.mimeTypes); | ||
// If any of the headers provided don't match, then don't return 304 | ||
if (modifiedSince && (new Date(Date.parse(modifiedSince))) < stat.mtime) { | ||
return false; | ||
// Catch "illegal access" dates that will crash v8 | ||
// https://github.com/jfhbrook/node-ecstatic/pull/179 | ||
if (modifiedSince) { | ||
try { | ||
var modifiedDate = new Date(Date.parse(modifiedSince)); | ||
} | ||
catch (err) { return false } | ||
if (modifiedDate.toString() === 'Invalid Date') { | ||
return false; | ||
} | ||
// If any of the headers provided don't match, then don't return 304 | ||
if (modifiedDate < stat.mtime) { | ||
return false; | ||
} | ||
} | ||
@@ -285,0 +301,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple static file server middleware that works with both Express and Flatiron", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"homepage": "https://github.com/jfhbrook/node-ecstatic", | ||
@@ -36,3 +36,3 @@ "repository": { | ||
"request": "^2.49.0", | ||
"tap": "^1.0.3", | ||
"tap": "^2.3.1", | ||
"union": "^0.4.4" | ||
@@ -39,0 +39,0 @@ }, |
@@ -67,2 +67,3 @@ # Ecstatic [![build status](https://secure.travis-ci.org/jfhbrook/node-ecstatic.png)](http://travis-ci.org/jfhbrook/node-ecstatic) | ||
root : __dirname + '/public', | ||
port : 8000, | ||
baseDir : '/', | ||
@@ -92,2 +93,6 @@ cache : 3600, | ||
### `opts.port` | ||
`opts.port` is the port you want ecstatic to listen to. Defaults to 8000. | ||
### `opts.baseDir` | ||
@@ -226,3 +231,5 @@ | ||
contributing, take a quick look at the contributing guidelines in | ||
./CONTRIBUTING.md . They're relatively painless, I promise. | ||
[./CONTRIBUTING.md](./CONTRIBUTING.md) . They're relatively painless, I promise. | ||
For Windows users, it is especially important to read the [./CONTRIBUTING.md](./CONTRIBUTING.md) | ||
section as you can **not** clone ecstatic without changing some settings in git. | ||
@@ -229,0 +236,0 @@ # License: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
243684
855
236