fresh 0.0.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/History.md ADDED
@@ -0,0 +1,10 @@
1
+
2
+ 0.2.1 / 2014-01-29
3
+ ==================
4
+
5
+ * fix: support max-age=0 for end-to-end revalidation
6
+
7
+ 0.2.0 / 2013-08-11
8
+ ==================
9
+
10
+ * fix: return false for no-cache
package/Readme.md CHANGED
@@ -29,4 +29,29 @@ fresh(req, res);
29
29
 
30
30
  ```
31
31
  $ npm install fresh
32
- ```
32
+ ```
33
+
34
+ ## License
35
+
36
+ (The MIT License)
37
+
38
+ Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
39
+
40
+ Permission is hereby granted, free of charge, to any person obtaining
41
+ a copy of this software and associated documentation files (the
42
+ 'Software'), to deal in the Software without restriction, including
43
+ without limitation the rights to use, copy, modify, merge, publish,
44
+ distribute, sublicense, and/or sell copies of the Software, and to
45
+ permit persons to whom the Software is furnished to do so, subject to
46
+ the following conditions:
47
+
48
+ The above copyright notice and this permission notice shall be
49
+ included in all copies or substantial portions of the Software.
50
+
51
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
52
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
53
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
54
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
55
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
56
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
57
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/index.js CHANGED
@@ -28,15 +28,19 @@ function fresh(req, res) {
28
28
  var noneMatch = req['if-none-match'];
29
29
  var lastModified = res['last-modified'];
30
30
  var etag = res['etag'];
31
+ var cc = req['cache-control'];
31
32
 
32
33
  // unconditional request
33
34
  if (!modifiedSince && !noneMatch) return false;
34
35
 
36
+ // check for no-cache cache request directive
37
+ if (cc && cc.indexOf('no-cache') !== -1) return false;
38
+
35
39
  // parse if-none-match
36
40
  if (noneMatch) noneMatch = noneMatch.split(/ *, */);
37
41
 
38
42
  // if-none-match
39
- if (noneMatch) etagMatches = ~noneMatch.indexOf(etag);
43
+ if (noneMatch) etagMatches = ~noneMatch.indexOf(etag) || '*' == noneMatch[0];
40
44
 
41
45
  // if-modified-since
42
46
  if (modifiedSince) {
package/package.json CHANGED
@@ -2,11 +2,19 @@
2
2
  "name": "fresh",
3
3
  "author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",
4
4
  "description": "HTTP response freshness testing",
5
- "version": "0.0.1",
5
+ "version": "0.2.2",
6
6
  "main": "index.js",
7
+ "repository": { "type": "git", "url": "https://github.com/visionmedia/node-fresh.git"},
7
8
  "dependencies": {},
9
+ "repository": { "type": "git", "url": "https://github.com/visionmedia/node-fresh.git" },
8
10
  "devDependencies": {
9
11
  "mocha": "*",
10
12
  "should": "*"
11
- }
13
+ },
14
+ "licenses": [
15
+ {
16
+ "type": "MIT",
17
+ "url": "https://github.com/visionmedia/node-fresh/blob/master/Readme.md#license"
18
+ }
19
+ ]
12
20
  }