fsevents 1.2.3 → 1.2.8
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.
Potentially problematic release.
This version of fsevents might be problematic. Click here for more details.
- package/.travis.yml +1 -3
- package/fsevents.cc +6 -15
- package/node_modules/abbrev/package.json +13 -14
- package/node_modules/ansi-regex/package.json +13 -14
- package/node_modules/aproba/package.json +13 -14
- package/node_modules/are-we-there-yet/CHANGES.md +6 -0
- package/node_modules/are-we-there-yet/package.json +19 -20
- package/node_modules/are-we-there-yet/tracker-stream.js +1 -0
- package/node_modules/balanced-match/package.json +13 -14
- package/node_modules/brace-expansion/package.json +13 -14
- package/node_modules/chownr/chownr.js +74 -38
- package/node_modules/chownr/package.json +22 -20
- package/node_modules/code-point-at/package.json +13 -14
- package/node_modules/concat-map/package.json +8 -9
- package/node_modules/console-control-strings/package.json +14 -14
- package/node_modules/core-util-is/package.json +13 -14
- package/node_modules/debug/CHANGELOG.md +34 -1
- package/node_modules/debug/README.md +206 -63
- package/node_modules/debug/dist/debug.js +912 -0
- package/node_modules/debug/package.json +46 -33
- package/node_modules/debug/src/browser.js +185 -106
- package/node_modules/debug/src/common.js +266 -0
- package/node_modules/debug/src/index.js +4 -4
- package/node_modules/debug/src/node.js +174 -165
- package/node_modules/deep-extend/CHANGELOG.md +28 -3
- package/node_modules/deep-extend/LICENSE +1 -1
- package/node_modules/deep-extend/README.md +2 -1
- package/node_modules/deep-extend/lib/deep-extend.js +11 -5
- package/node_modules/deep-extend/package.json +26 -28
- package/node_modules/delegates/package.json +13 -14
- package/node_modules/detect-libc/package.json +13 -14
- package/node_modules/fs-minipass/package.json +13 -14
- package/node_modules/fs.realpath/package.json +13 -14
- package/node_modules/gauge/package.json +13 -14
- package/node_modules/glob/package.json +18 -19
- package/node_modules/has-unicode/package.json +13 -14
- package/node_modules/iconv-lite/Changelog.md +16 -0
- package/node_modules/iconv-lite/encodings/sbcs-codec.js +2 -2
- package/node_modules/iconv-lite/encodings/sbcs-data.js +5 -0
- package/node_modules/iconv-lite/lib/extend-node.js +1 -1
- package/node_modules/iconv-lite/lib/index.d.ts +2 -2
- package/node_modules/iconv-lite/package.json +19 -20
- package/node_modules/ignore-walk/package.json +13 -14
- package/node_modules/inflight/package.json +13 -14
- package/node_modules/inherits/package.json +14 -14
- package/node_modules/ini/package.json +13 -14
- package/node_modules/is-fullwidth-code-point/package.json +13 -14
- package/node_modules/isarray/package.json +13 -14
- package/node_modules/minimatch/package.json +14 -14
- package/node_modules/minimist/package.json +8 -9
- package/node_modules/minipass/LICENSE +15 -0
- package/node_modules/minipass/README.md +81 -3
- package/node_modules/minipass/index.js +77 -6
- package/node_modules/minipass/package.json +21 -20
- package/node_modules/minizlib/index.js +66 -95
- package/node_modules/minizlib/package.json +18 -19
- package/node_modules/mkdirp/package.json +14 -14
- package/node_modules/ms/index.js +28 -18
- package/node_modules/ms/package.json +22 -23
- package/node_modules/ms/readme.md +17 -8
- package/node_modules/needle/.npmignore +6 -0
- package/node_modules/needle/README.md +3 -3
- package/node_modules/needle/examples/multipart-stream.js +1 -1
- package/node_modules/needle/lib/auth.js +1 -1
- package/node_modules/needle/lib/cookies.js +12 -10
- package/node_modules/needle/lib/multipart.js +1 -1
- package/node_modules/needle/lib/needle.js +18 -6
- package/node_modules/needle/package-lock.json +395 -0
- package/node_modules/needle/package.json +26 -27
- package/node_modules/needle/test/basic_auth_spec.js +1 -1
- package/node_modules/needle/test/cookies_spec.js +2 -2
- package/node_modules/needle/test/errors_spec.js +4 -4
- package/node_modules/needle/test/keys/ssl.cert +21 -0
- package/node_modules/needle/test/keys/ssl.key +27 -0
- package/node_modules/needle/test/long_string_spec.js +1 -1
- package/node_modules/needle/test/output_spec.js +1 -1
- package/node_modules/needle/test/post_data_spec.js +20 -20
- package/node_modules/needle/test/proxy_spec.js +1 -1
- package/node_modules/needle/test/url_spec.js +11 -3
- package/node_modules/needle/test/utils/test.js +1 -1
- package/node_modules/node-pre-gyp/CHANGELOG.md +34 -3
- package/node_modules/node-pre-gyp/README.md +53 -21
- package/node_modules/node-pre-gyp/appveyor.yml +2 -9
- package/node_modules/node-pre-gyp/contributing.md +2 -2
- package/node_modules/node-pre-gyp/lib/build.js +1 -1
- package/node_modules/node-pre-gyp/lib/install.js +46 -12
- package/node_modules/node-pre-gyp/lib/node-pre-gyp.js +1 -1
- package/node_modules/node-pre-gyp/lib/package.js +5 -2
- package/node_modules/node-pre-gyp/lib/pre-binding.js +5 -5
- package/node_modules/node-pre-gyp/lib/rebuild.js +1 -1
- package/node_modules/node-pre-gyp/lib/reinstall.js +1 -1
- package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +148 -0
- package/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js +5 -2
- package/node_modules/node-pre-gyp/lib/util/napi.js +70 -22
- package/node_modules/node-pre-gyp/lib/util/versioning.js +7 -6
- package/node_modules/node-pre-gyp/package.json +16 -19
- package/node_modules/nopt/package.json +13 -14
- package/node_modules/npm-bundled/LICENSE +15 -0
- package/node_modules/npm-bundled/README.md +2 -0
- package/node_modules/npm-bundled/index.js +16 -2
- package/node_modules/npm-bundled/package.json +18 -19
- package/node_modules/npm-packlist/index.js +43 -13
- package/node_modules/npm-packlist/package.json +18 -19
- package/node_modules/npmlog/package.json +13 -14
- package/node_modules/number-is-nan/package.json +13 -14
- package/node_modules/object-assign/package.json +13 -14
- package/node_modules/once/package.json +14 -14
- package/node_modules/os-homedir/package.json +13 -14
- package/node_modules/os-tmpdir/package.json +13 -14
- package/node_modules/osenv/package.json +13 -14
- package/node_modules/path-is-absolute/package.json +13 -14
- package/node_modules/process-nextick-args/package.json +13 -14
- package/node_modules/rc/node_modules/minimist/package.json +13 -14
- package/node_modules/rc/package.json +18 -19
- package/node_modules/readable-stream/package.json +13 -14
- package/node_modules/rimraf/package.json +22 -20
- package/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/safe-buffer/package.json +23 -21
- package/node_modules/safer-buffer/package.json +13 -14
- package/node_modules/sax/package.json +13 -14
- package/node_modules/semver/CHANGELOG.md +39 -0
- package/node_modules/semver/README.md +31 -8
- package/node_modules/semver/bin/semver +92 -75
- package/node_modules/semver/package.json +25 -20
- package/node_modules/semver/semver.js +922 -763
- package/node_modules/set-blocking/package.json +13 -14
- package/node_modules/signal-exit/package.json +13 -14
- package/node_modules/string-width/package.json +14 -14
- package/node_modules/string_decoder/package.json +13 -14
- package/node_modules/strip-ansi/package.json +14 -14
- package/node_modules/strip-json-comments/package.json +13 -14
- package/node_modules/tar/README.md +7 -2
- package/node_modules/tar/lib/header.js +20 -4
- package/node_modules/tar/lib/mode-fix.js +14 -0
- package/node_modules/tar/lib/pack.js +1 -0
- package/node_modules/tar/lib/parse.js +2 -1
- package/node_modules/tar/lib/unpack.js +67 -6
- package/node_modules/tar/lib/write-entry.js +25 -6
- package/node_modules/tar/package.json +25 -26
- package/node_modules/util-deprecate/package.json +13 -14
- package/node_modules/wide-align/package.json +19 -20
- package/node_modules/wrappy/package.json +14 -14
- package/node_modules/yallist/iterator.js +5 -5
- package/node_modules/yallist/package.json +19 -19
- package/node_modules/yallist/yallist.js +2 -2
- package/package.json +6 -9
- package/src/async.cc +2 -2
- package/src/thread.cc +5 -6
- package/.npmignore +0 -1
- package/build/.target.mk +0 -53
- package/build/Makefile +0 -352
- package/build/Release/.deps/Release/.node.d +0 -1
- package/build/Release/.deps/Release/fse.node.d +0 -1
- package/build/Release/.deps/Release/obj.target/action_after_build.stamp.d +0 -1
- package/build/Release/.deps/Release/obj.target/fse/fsevents.o.d +0 -65
- package/build/Release/.deps/Users/eshanker/Code/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node.d +0 -1
- package/build/Release/.node +0 -0
- package/build/Release/fse.node +0 -0
- package/build/Release/obj.target/action_after_build.stamp +0 -0
- package/build/Release/obj.target/fse/fsevents.o +0 -0
- package/build/action_after_build.target.mk +0 -32
- package/build/binding.Makefile +0 -6
- package/build/fse.target.mk +0 -179
- package/build/gyp-mac-tool +0 -611
- package/build/stage/v1.1.2/fse-v1.1.2-node-v48-darwin-x64.tar.gz +0 -0
- package/lib/binding/Release/node-v11-darwin-x64/fse.node +0 -0
- package/lib/binding/Release/node-v46-darwin-x64/fse.node +0 -0
- package/lib/binding/Release/node-v47-darwin-x64/fse.node +0 -0
- package/lib/binding/Release/node-v48-darwin-x64/fse.node +0 -0
- package/lib/binding/Release/node-v57-darwin-x64/fse.node +0 -0
- package/node_modules/are-we-there-yet/CHANGES.md~ +0 -27
- package/node_modules/debug/.coveralls.yml +0 -1
- package/node_modules/debug/.eslintrc +0 -11
- package/node_modules/debug/.npmignore +0 -9
- package/node_modules/debug/.travis.yml +0 -14
- package/node_modules/debug/Makefile +0 -50
- package/node_modules/debug/component.json +0 -19
- package/node_modules/debug/karma.conf.js +0 -70
- package/node_modules/debug/node.js +0 -1
- package/node_modules/debug/src/debug.js +0 -202
- package/node_modules/debug/src/inspector-log.js +0 -15
- package/node_modules/iconv-lite/.travis.yml +0 -23
- package/node_modules/rc/.npmignore +0 -3
- package/node_modules/safe-buffer/.travis.yml +0 -7
- package/node_modules/safe-buffer/test.js +0 -101
- package/src/locking.cc +0 -27
package/node_modules/ms/index.js
CHANGED
@@ -6,6 +6,7 @@ var s = 1000;
|
|
6
6
|
var m = s * 60;
|
7
7
|
var h = m * 60;
|
8
8
|
var d = h * 24;
|
9
|
+
var w = d * 7;
|
9
10
|
var y = d * 365.25;
|
10
11
|
|
11
12
|
/**
|
@@ -49,7 +50,7 @@ function parse(str) {
|
|
49
50
|
if (str.length > 100) {
|
50
51
|
return;
|
51
52
|
}
|
52
|
-
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
|
53
|
+
var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
53
54
|
str
|
54
55
|
);
|
55
56
|
if (!match) {
|
@@ -64,6 +65,10 @@ function parse(str) {
|
|
64
65
|
case 'yr':
|
65
66
|
case 'y':
|
66
67
|
return n * y;
|
68
|
+
case 'weeks':
|
69
|
+
case 'week':
|
70
|
+
case 'w':
|
71
|
+
return n * w;
|
67
72
|
case 'days':
|
68
73
|
case 'day':
|
69
74
|
case 'd':
|
@@ -106,16 +111,17 @@ function parse(str) {
|
|
106
111
|
*/
|
107
112
|
|
108
113
|
function fmtShort(ms) {
|
109
|
-
|
114
|
+
var msAbs = Math.abs(ms);
|
115
|
+
if (msAbs >= d) {
|
110
116
|
return Math.round(ms / d) + 'd';
|
111
117
|
}
|
112
|
-
if (
|
118
|
+
if (msAbs >= h) {
|
113
119
|
return Math.round(ms / h) + 'h';
|
114
120
|
}
|
115
|
-
if (
|
121
|
+
if (msAbs >= m) {
|
116
122
|
return Math.round(ms / m) + 'm';
|
117
123
|
}
|
118
|
-
if (
|
124
|
+
if (msAbs >= s) {
|
119
125
|
return Math.round(ms / s) + 's';
|
120
126
|
}
|
121
127
|
return ms + 'ms';
|
@@ -130,23 +136,27 @@ function fmtShort(ms) {
|
|
130
136
|
*/
|
131
137
|
|
132
138
|
function fmtLong(ms) {
|
133
|
-
|
134
|
-
|
135
|
-
plural(ms,
|
136
|
-
|
137
|
-
|
139
|
+
var msAbs = Math.abs(ms);
|
140
|
+
if (msAbs >= d) {
|
141
|
+
return plural(ms, msAbs, d, 'day');
|
142
|
+
}
|
143
|
+
if (msAbs >= h) {
|
144
|
+
return plural(ms, msAbs, h, 'hour');
|
145
|
+
}
|
146
|
+
if (msAbs >= m) {
|
147
|
+
return plural(ms, msAbs, m, 'minute');
|
148
|
+
}
|
149
|
+
if (msAbs >= s) {
|
150
|
+
return plural(ms, msAbs, s, 'second');
|
151
|
+
}
|
152
|
+
return ms + ' ms';
|
138
153
|
}
|
139
154
|
|
140
155
|
/**
|
141
156
|
* Pluralization helper.
|
142
157
|
*/
|
143
158
|
|
144
|
-
function plural(ms, n, name) {
|
145
|
-
|
146
|
-
|
147
|
-
}
|
148
|
-
if (ms < n * 1.5) {
|
149
|
-
return Math.floor(ms / n) + ' ' + name;
|
150
|
-
}
|
151
|
-
return Math.ceil(ms / n) + ' ' + name + 's';
|
159
|
+
function plural(ms, msAbs, n, name) {
|
160
|
+
var isPlural = msAbs >= n * 1.5;
|
161
|
+
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
152
162
|
}
|
@@ -1,40 +1,39 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
|
4
|
-
"ms@2.0.0",
|
5
|
-
"/Users/eshanker/Code/fsevents"
|
6
|
-
]
|
7
|
-
],
|
8
|
-
"_from": "ms@2.0.0",
|
9
|
-
"_id": "ms@2.0.0",
|
2
|
+
"_from": "ms@^2.1.1",
|
3
|
+
"_id": "ms@2.1.1",
|
10
4
|
"_inBundle": false,
|
11
|
-
"_integrity": "
|
5
|
+
"_integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
|
12
6
|
"_location": "/ms",
|
13
7
|
"_phantomChildren": {},
|
14
8
|
"_requested": {
|
15
|
-
"type": "
|
9
|
+
"type": "range",
|
16
10
|
"registry": true,
|
17
|
-
"raw": "ms
|
11
|
+
"raw": "ms@^2.1.1",
|
18
12
|
"name": "ms",
|
19
13
|
"escapedName": "ms",
|
20
|
-
"rawSpec": "2.
|
14
|
+
"rawSpec": "^2.1.1",
|
21
15
|
"saveSpec": null,
|
22
|
-
"fetchSpec": "2.
|
16
|
+
"fetchSpec": "^2.1.1"
|
23
17
|
},
|
24
|
-
"_requiredBy": [
|
25
|
-
|
26
|
-
|
27
|
-
"
|
18
|
+
"_requiredBy": [
|
19
|
+
"/debug"
|
20
|
+
],
|
21
|
+
"_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
22
|
+
"_shasum": "30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a",
|
23
|
+
"_spec": "ms@^2.1.1",
|
24
|
+
"_where": "/Users/pipobscure/fsevents/node_modules/debug",
|
28
25
|
"bugs": {
|
29
26
|
"url": "https://github.com/zeit/ms/issues"
|
30
27
|
},
|
31
|
-
"
|
28
|
+
"bundleDependencies": false,
|
29
|
+
"deprecated": false,
|
30
|
+
"description": "Tiny millisecond conversion utility",
|
32
31
|
"devDependencies": {
|
33
|
-
"eslint": "
|
32
|
+
"eslint": "4.12.1",
|
34
33
|
"expect.js": "0.3.1",
|
35
|
-
"husky": "0.
|
36
|
-
"lint-staged": "
|
37
|
-
"mocha": "
|
34
|
+
"husky": "0.14.3",
|
35
|
+
"lint-staged": "5.0.0",
|
36
|
+
"mocha": "4.0.1"
|
38
37
|
},
|
39
38
|
"eslintConfig": {
|
40
39
|
"extends": "eslint:recommended",
|
@@ -66,5 +65,5 @@
|
|
66
65
|
"precommit": "lint-staged",
|
67
66
|
"test": "mocha tests.js"
|
68
67
|
},
|
69
|
-
"version": "2.
|
68
|
+
"version": "2.1.1"
|
70
69
|
}
|
@@ -17,35 +17,44 @@ ms('1m') // 60000
|
|
17
17
|
ms('5s') // 5000
|
18
18
|
ms('1y') // 31557600000
|
19
19
|
ms('100') // 100
|
20
|
+
ms('-3 days') // -259200000
|
21
|
+
ms('-1h') // -3600000
|
22
|
+
ms('-200') // -200
|
20
23
|
```
|
21
24
|
|
22
|
-
### Convert from
|
25
|
+
### Convert from Milliseconds
|
23
26
|
|
24
27
|
```js
|
25
28
|
ms(60000) // "1m"
|
26
29
|
ms(2 * 60000) // "2m"
|
30
|
+
ms(-3 * 60000) // "-3m"
|
27
31
|
ms(ms('10 hours')) // "10h"
|
28
32
|
```
|
29
33
|
|
30
|
-
### Time
|
34
|
+
### Time Format Written-Out
|
31
35
|
|
32
36
|
```js
|
33
37
|
ms(60000, { long: true }) // "1 minute"
|
34
38
|
ms(2 * 60000, { long: true }) // "2 minutes"
|
39
|
+
ms(-3 * 60000, { long: true }) // "-3 minutes"
|
35
40
|
ms(ms('10 hours'), { long: true }) // "10 hours"
|
36
41
|
```
|
37
42
|
|
38
43
|
## Features
|
39
44
|
|
40
|
-
- Works both in [
|
41
|
-
- If a number is supplied to `ms`, a string with a unit is returned
|
42
|
-
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
|
43
|
-
- If you pass a string with a number and a valid unit, the number of equivalent
|
45
|
+
- Works both in [Node.js](https://nodejs.org) and in the browser
|
46
|
+
- If a number is supplied to `ms`, a string with a unit is returned
|
47
|
+
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
|
48
|
+
- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
|
44
49
|
|
45
|
-
##
|
50
|
+
## Related Packages
|
51
|
+
|
52
|
+
- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
|
53
|
+
|
54
|
+
## Caught a Bug?
|
46
55
|
|
47
56
|
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
48
57
|
2. Link the package to the global module directory: `npm link`
|
49
|
-
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm,
|
58
|
+
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
|
50
59
|
|
51
60
|
As always, you can run the tests using: `npm test`
|
@@ -35,7 +35,7 @@ needle
|
|
35
35
|
From version 2.0.x up, Promises are also supported. Just call `needle()` directly and you'll get a native Promise object.
|
36
36
|
|
37
37
|
```js
|
38
|
-
needle('put', 'https://hacking.the.gibson/login', { password: 'god' })
|
38
|
+
needle('put', 'https://hacking.the.gibson/login', { password: 'god' }, { json: true })
|
39
39
|
.then(function(response) {
|
40
40
|
return doSomethingWith(response)
|
41
41
|
})
|
@@ -78,8 +78,7 @@ needle('get', 'https://server.com/posts/12')
|
|
78
78
|
})
|
79
79
|
.catch(function(err) {
|
80
80
|
// ...
|
81
|
-
})
|
82
|
-
});
|
81
|
+
});
|
83
82
|
|
84
83
|
// with callback
|
85
84
|
needle.get('ifconfig.me/all.json', function(error, response, body) {
|
@@ -313,6 +312,7 @@ For information about options that've changed, there's always [the changelog](ht
|
|
313
312
|
- `headers` : Object containing custom HTTP headers for request. Overrides defaults described below.
|
314
313
|
- `auth` : Determines what to do with provided username/password. Options are `auto`, `digest` or `basic` (default). `auto` will detect the type of authentication depending on the response headers.
|
315
314
|
- `stream_length`: When sending streams, this lets you manually set the Content-Length header --if the stream's bytecount is known beforehand--, preventing ECONNRESET (socket hang up) errors on some servers that misbehave when receiving payloads of unknown size. Set it to `0` and Needle will get and set the stream's length for you, or leave unset for the default behaviour, which is no Content-Length header for stream payloads.
|
315
|
+
- `localAddress` : <string>, IP address. Passed to http/https request. Local interface from witch the request should be emitted.
|
316
316
|
|
317
317
|
Response options
|
318
318
|
----------------
|
@@ -2,7 +2,7 @@ var needle = require('./../');
|
|
2
2
|
|
3
3
|
var url = 'http://posttestserver.com/post.php?dir=needle';
|
4
4
|
|
5
|
-
var black_pixel =
|
5
|
+
var black_pixel = Buffer.from("R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", 'base64');
|
6
6
|
|
7
7
|
var data = {
|
8
8
|
foo: 'bar',
|
@@ -21,7 +21,7 @@ function md5(string) {
|
|
21
21
|
|
22
22
|
function basic(user, pass) {
|
23
23
|
var str = typeof pass == 'undefined' ? user : [user, pass].join(':');
|
24
|
-
return 'Basic ' +
|
24
|
+
return 'Basic ' + Buffer.from(str).toString('base64');
|
25
25
|
}
|
26
26
|
|
27
27
|
////////////////////
|
@@ -1,22 +1,24 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
// Simple cookie handling implementation based on the standard RFC 6265.
|
3
|
+
//
|
3
4
|
// This module just has two functionalities:
|
4
5
|
// - Parse a set-cookie-header as a key value object
|
5
6
|
// - Write a cookie-string from a key value object
|
6
|
-
// All cookie attributes are ignored.
|
7
7
|
//
|
8
|
+
// All cookie attributes are ignored.
|
8
9
|
|
9
10
|
var unescape = require('querystring').unescape;
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/;
|
13
|
+
var EXCLUDED_CHARS = /[\x00-\x1F\x7F\x3B\x3B\s\"\,\\"%]/g;
|
14
|
+
var TRAILING_SEMICOLON = /\x3B+$/;
|
15
|
+
var SEP_SEMICOLON = /\s*\x3B\s*/;
|
16
|
+
|
17
|
+
// i know these should be 'const', but I'd like to keep
|
18
|
+
// supporting earlier node.js versions as long as I can. :)
|
16
19
|
|
17
|
-
//
|
18
|
-
|
19
|
-
const VALUE_INDEX = 3; // index of value from COOKIE_PAIR match
|
20
|
+
var KEY_INDEX = 1; // index of key from COOKIE_PAIR match
|
21
|
+
var VALUE_INDEX = 3; // index of value from COOKIE_PAIR match
|
20
22
|
|
21
23
|
// Returns a copy str trimmed and without trainling semicolon.
|
22
24
|
function cleanCookieString(str) {
|
@@ -73,7 +73,7 @@ function generate_part(name, part, boundary, callback) {
|
|
73
73
|
}
|
74
74
|
|
75
75
|
return_part += '\r\n\r\n';
|
76
|
-
return_part +=
|
76
|
+
return_part += Buffer.from(String(part.value), 'utf8').toString('binary');
|
77
77
|
append();
|
78
78
|
|
79
79
|
}
|
@@ -194,7 +194,9 @@ Needle.prototype.setup = function(uri, options) {
|
|
194
194
|
// the basics
|
195
195
|
|
196
196
|
var config = {
|
197
|
-
http_opts : {
|
197
|
+
http_opts : {
|
198
|
+
localAddress: get_option('localAddress', undefined)
|
199
|
+
}, // passed later to http.request() directly
|
198
200
|
output : options.output,
|
199
201
|
proxy : get_option('proxy', defaults.proxy),
|
200
202
|
parser : get_option('parse_response', defaults.parse_response),
|
@@ -345,7 +347,7 @@ Needle.prototype.start = function() {
|
|
345
347
|
: json ? JSON.stringify(data) : stringify(data);
|
346
348
|
|
347
349
|
// ensure we have a buffer so bytecount is correct.
|
348
|
-
body =
|
350
|
+
body = Buffer.from(body, config.encoding);
|
349
351
|
}
|
350
352
|
|
351
353
|
}
|
@@ -639,7 +641,7 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
639
641
|
var chunk;
|
640
642
|
while ((chunk = this.read()) !== null) {
|
641
643
|
// We're either pushing buffers or objects, never strings.
|
642
|
-
if (typeof chunk == 'string') chunk =
|
644
|
+
if (typeof chunk == 'string') chunk = Buffer.from(chunk);
|
643
645
|
|
644
646
|
// Push all chunks to resp.body. We'll bind them in resp.end().
|
645
647
|
resp.body.push(chunk);
|
@@ -695,15 +697,25 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
|
|
695
697
|
// handle errors on the request object. things might get bumpy.
|
696
698
|
request.on('error', had_error);
|
697
699
|
|
700
|
+
// make sure timer is cleared if request is aborted (issue #257)
|
701
|
+
request.once('abort', function() {
|
702
|
+
if (timer) clearTimeout(timer);
|
703
|
+
})
|
704
|
+
|
698
705
|
// handle socket 'end' event to ensure we don't get delayed EPIPE errors.
|
699
706
|
request.once('socket', function(socket) {
|
700
|
-
socket.
|
707
|
+
if (socket.connecting) {
|
708
|
+
socket.once('connect', function() {
|
709
|
+
set_timeout('response', config.response_timeout);
|
710
|
+
})
|
711
|
+
} else {
|
701
712
|
set_timeout('response', config.response_timeout);
|
702
|
-
}
|
713
|
+
}
|
703
714
|
|
715
|
+
// console.log(socket);
|
704
716
|
if (!socket.on_socket_end) {
|
705
717
|
socket.on_socket_end = on_socket_end;
|
706
|
-
socket.
|
718
|
+
socket.once('end', function() { process.nextTick(on_socket_end.bind(socket)) });
|
707
719
|
}
|
708
720
|
})
|
709
721
|
|