node-red-contrib-web-worldmap 2.33.0 → 2.35.0
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/CHANGELOG.md +2 -0
- package/README.md +3 -8
- package/node_modules/@turf/bezier-spline/package.json +70 -39
- package/node_modules/@turf/helpers/package.json +82 -38
- package/node_modules/@turf/invariant/package.json +73 -36
- package/node_modules/accepts/package.json +55 -15
- package/node_modules/array-flatten/package.json +47 -22
- package/node_modules/body-parser/HISTORY.md +0 -6
- package/node_modules/body-parser/README.md +1 -1
- package/node_modules/body-parser/index.js +9 -8
- package/node_modules/body-parser/node_modules/bytes/package.json +62 -20
- package/node_modules/body-parser/package.json +57 -18
- package/node_modules/bufferjs/package.json +65 -17
- package/node_modules/bufferlist/package.json +51 -15
- package/node_modules/call-bind/package.json +106 -78
- package/node_modules/cgi/package.json +46 -10
- package/node_modules/compressible/package.json +58 -15
- package/node_modules/compression/node_modules/bytes/package.json +84 -0
- package/node_modules/compression/package.json +52 -10
- package/node_modules/content-disposition/node_modules/safe-buffer/package.json +43 -18
- package/node_modules/content-disposition/package.json +49 -14
- package/node_modules/content-type/package.json +54 -15
- package/node_modules/cookie/package.json +52 -14
- package/node_modules/cookie-signature/package.json +47 -8
- package/node_modules/debug/package.json +68 -21
- package/node_modules/depd/package.json +51 -13
- package/node_modules/destroy/package.json +50 -15
- package/node_modules/ee-first/package.json +43 -9
- package/node_modules/encodeurl/package.json +52 -14
- package/node_modules/escape-html/package.json +47 -12
- package/node_modules/etag/package.json +54 -15
- package/node_modules/express/History.md +0 -9
- package/node_modules/express/Readme.md +2 -2
- package/node_modules/express/lib/router/route.js +8 -8
- package/node_modules/express/node_modules/safe-buffer/package.json +43 -18
- package/node_modules/express/package.json +88 -33
- package/node_modules/extend/package.json +78 -42
- package/node_modules/faye-websocket/package.json +64 -33
- package/node_modules/finalhandler/package.json +44 -9
- package/node_modules/forwarded/package.json +49 -14
- package/node_modules/fresh/package.json +61 -17
- package/node_modules/function-bind/package.json +56 -23
- package/node_modules/get-intrinsic/package.json +118 -89
- package/node_modules/has/package.json +46 -21
- package/node_modules/has-symbols/package.json +124 -99
- package/node_modules/header-stack/package.json +48 -14
- package/node_modules/http-errors/package.json +63 -18
- package/node_modules/iconv-lite/package.json +77 -43
- package/node_modules/inherits/package.json +44 -12
- package/node_modules/ipaddr.js/package.json +48 -13
- package/node_modules/media-typer/package.json +43 -8
- package/node_modules/merge-descriptors/package.json +47 -10
- package/node_modules/methods/package.json +60 -17
- package/node_modules/mime/package.json +45 -13
- package/node_modules/mime-db/HISTORY.md +0 -8
- package/node_modules/mime-db/LICENSE +18 -19
- package/node_modules/mime-db/README.md +1 -1
- package/node_modules/mime-db/db.json +6 -54
- package/node_modules/mime-db/index.js +0 -1
- package/node_modules/mime-db/package.json +67 -24
- package/node_modules/mime-types/HISTORY.md +0 -9
- package/node_modules/mime-types/README.md +1 -1
- package/node_modules/mime-types/package.json +63 -19
- package/node_modules/ms/package.json +54 -19
- package/node_modules/negotiator/package.json +61 -19
- package/node_modules/object-inspect/package.json +76 -48
- package/node_modules/on-finished/package.json +50 -8
- package/node_modules/on-headers/package.json +52 -14
- package/node_modules/parseurl/package.json +54 -10
- package/node_modules/path-to-regexp/package.json +44 -15
- package/node_modules/proxy-addr/package.json +49 -14
- package/node_modules/qs/.editorconfig +0 -3
- package/node_modules/qs/.eslintrc +5 -5
- package/node_modules/qs/CHANGELOG.md +0 -158
- package/node_modules/qs/README.md +1 -3
- package/node_modules/qs/dist/qs.js +9 -19
- package/node_modules/qs/lib/stringify.js +3 -12
- package/node_modules/qs/package.json +98 -73
- package/node_modules/qs/test/parse.js +0 -14
- package/node_modules/qs/test/stringify.js +10 -54
- package/node_modules/range-parser/package.json +68 -18
- package/node_modules/raw-body/node_modules/bytes/package.json +62 -20
- package/node_modules/raw-body/package.json +51 -9
- package/node_modules/safe-buffer/package.json +36 -5
- package/node_modules/safer-buffer/package.json +42 -13
- package/node_modules/send/node_modules/ms/package.json +52 -20
- package/node_modules/send/package.json +62 -17
- package/node_modules/serve-static/package.json +44 -9
- package/node_modules/setprototypeof/package.json +55 -27
- package/node_modules/side-channel/package.json +93 -65
- package/node_modules/sockjs/package.json +70 -43
- package/node_modules/statuses/package.json +61 -19
- package/node_modules/stream-stack/package.json +43 -11
- package/node_modules/toidentifier/package.json +51 -9
- package/node_modules/type-is/package.json +55 -12
- package/node_modules/unpipe/package.json +45 -8
- package/node_modules/utils-merge/package.json +45 -19
- package/node_modules/uuid/package.json +99 -70
- package/node_modules/vary/package.json +52 -13
- package/node_modules/websocket-driver/node_modules/http-parser-js/README.md +31 -0
- package/node_modules/{http-parser-js → websocket-driver/node_modules/http-parser-js}/http-parser.js +7 -12
- package/node_modules/websocket-driver/node_modules/http-parser-js/package.json +75 -0
- package/node_modules/websocket-driver/package.json +68 -33
- package/node_modules/websocket-extensions/package.json +61 -27
- package/package.json +1 -1
- package/worldmap/worldmap.js +6 -5
- package/node_modules/bytes/package.json +0 -39
- package/node_modules/faye-websocket/CHANGELOG.md +0 -139
- package/node_modules/header-stack/headers.js +0 -33
- package/node_modules/header-stack/index.js +0 -2
- package/node_modules/header-stack/parser.js +0 -131
- package/node_modules/header-stack/tests/dumps/multipart-folded-headers.eml +0 -27
- package/node_modules/header-stack/tests/dumps/simple-curl-get.dump +0 -5
- package/node_modules/header-stack/tests/test-empty.js +0 -15
- package/node_modules/header-stack/tests/test-multipart-folded-headers.js +0 -21
- package/node_modules/header-stack/tests/test-simple-curl-get.js +0 -32
- package/node_modules/http-parser-js/README.md +0 -43
- package/node_modules/http-parser-js/http-parser.d.ts +0 -175
- package/node_modules/http-parser-js/package.json +0 -30
- package/node_modules/path-to-regexp/History.md +0 -36
- package/node_modules/websocket-driver/CHANGELOG.md +0 -142
- package/node_modules/websocket-extensions/CHANGELOG.md +0 -28
- /package/node_modules/{bytes → compression/node_modules/bytes}/History.md +0 -0
- /package/node_modules/{bytes → compression/node_modules/bytes}/LICENSE +0 -0
- /package/node_modules/{bytes → compression/node_modules/bytes}/Readme.md +0 -0
- /package/node_modules/{bytes → compression/node_modules/bytes}/index.js +0 -0
- /package/node_modules/{http-parser-js → websocket-driver/node_modules/http-parser-js}/LICENSE.md +0 -0
package/package.json
CHANGED
package/worldmap/worldmap.js
CHANGED
|
@@ -1793,7 +1793,7 @@ function setMarker(data) {
|
|
|
1793
1793
|
marker = L.marker(ll, {title:data.name, icon:myMarker, draggable:drag});
|
|
1794
1794
|
labelOffset = [12,-4];
|
|
1795
1795
|
}
|
|
1796
|
-
else if (data.icon.match(/^https
|
|
1796
|
+
else if (data.icon.match(/^https?:.*$|^\//)) {
|
|
1797
1797
|
var sz = data.iconSize ?? 32;
|
|
1798
1798
|
myMarker = L.icon({
|
|
1799
1799
|
iconUrl: data.icon,
|
|
@@ -2024,12 +2024,11 @@ function setMarker(data) {
|
|
|
2024
2024
|
if (data.fill) { delete data.fill; }
|
|
2025
2025
|
if (data.draggable) { delete data.draggable; }
|
|
2026
2026
|
//if (!isNaN(data.speed)) { data.speed = data.speed.toFixed(2); }
|
|
2027
|
-
if (data.hasOwnProperty("clickable")) { delete data.clickable; }
|
|
2028
2027
|
if (data.hasOwnProperty("fillColor")) { delete data.fillColor; }
|
|
2029
2028
|
if (data.hasOwnProperty("radius")) { delete data.radius; }
|
|
2030
2029
|
if (data.hasOwnProperty("greatcircle")) { delete data.greatcircle; }
|
|
2031
2030
|
for (var i in data) {
|
|
2032
|
-
if ((i != "name") && (i != "length")) {
|
|
2031
|
+
if ((i != "name") && (i != "length") && (i != "clickable")) {
|
|
2033
2032
|
if (typeof data[i] === "object") {
|
|
2034
2033
|
words += i +" : "+JSON.stringify(data[i])+"<br/>";
|
|
2035
2034
|
} else {
|
|
@@ -2042,8 +2041,10 @@ function setMarker(data) {
|
|
|
2042
2041
|
words = "<b>"+data.name+"</b><br/>" + words; //"<button style=\"border-radius:4px; float:right; background-color:lightgrey;\" onclick='popped=false;popmark.closePopup();'>X</button><br/>" + words;
|
|
2043
2042
|
var wopt = {autoClose:false, closeButton:true, closeOnClick:false, minWidth:200};
|
|
2044
2043
|
if (words.indexOf('<video ') >=0 || words.indexOf('<img ') >=0 ) { wopt.maxWidth="640"; }
|
|
2045
|
-
|
|
2046
|
-
|
|
2044
|
+
if (!data.hasOwnProperty("clickable") && data.clickable != false) {
|
|
2045
|
+
marker.bindPopup(words, wopt);
|
|
2046
|
+
marker._popup.dname = data.name;
|
|
2047
|
+
}
|
|
2047
2048
|
marker.lay = lay; // and the layer it is on
|
|
2048
2049
|
|
|
2049
2050
|
// marker.on('click', function(e) {
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "bytes",
|
|
3
|
-
"description": "Utility to parse a string bytes to bytes and vice-versa",
|
|
4
|
-
"version": "3.0.0",
|
|
5
|
-
"author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",
|
|
6
|
-
"contributors": [
|
|
7
|
-
"Jed Watson <jed.watson@me.com>",
|
|
8
|
-
"Théo FIDRY <theo.fidry@gmail.com>"
|
|
9
|
-
],
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"keywords": [
|
|
12
|
-
"byte",
|
|
13
|
-
"bytes",
|
|
14
|
-
"utility",
|
|
15
|
-
"parse",
|
|
16
|
-
"parser",
|
|
17
|
-
"convert",
|
|
18
|
-
"converter"
|
|
19
|
-
],
|
|
20
|
-
"repository": "visionmedia/bytes.js",
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"mocha": "2.5.3",
|
|
23
|
-
"nyc": "10.3.2"
|
|
24
|
-
},
|
|
25
|
-
"files": [
|
|
26
|
-
"History.md",
|
|
27
|
-
"LICENSE",
|
|
28
|
-
"Readme.md",
|
|
29
|
-
"index.js"
|
|
30
|
-
],
|
|
31
|
-
"engines": {
|
|
32
|
-
"node": ">= 0.8"
|
|
33
|
-
},
|
|
34
|
-
"scripts": {
|
|
35
|
-
"test": "mocha --check-leaks --reporter spec",
|
|
36
|
-
"test-ci": "nyc --reporter=text npm test",
|
|
37
|
-
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
### 0.11.4 / 2021-05-24
|
|
2
|
-
|
|
3
|
-
- Prevent the client hanging if `close()` is called when already closing
|
|
4
|
-
|
|
5
|
-
### 0.11.3 / 2019-06-10
|
|
6
|
-
|
|
7
|
-
- Fix a race condition that caused a timeout not to be cancelled immediately
|
|
8
|
-
when the WebSocket is closed
|
|
9
|
-
- Change license from MIT to Apache 2.0
|
|
10
|
-
|
|
11
|
-
### 0.11.2 / 2019-06-10
|
|
12
|
-
|
|
13
|
-
(This version was pulled due to an error when publishing)
|
|
14
|
-
|
|
15
|
-
### 0.11.1 / 2017-01-22
|
|
16
|
-
|
|
17
|
-
- Forcibly close the I/O stream after a timeout if the peer does not respond
|
|
18
|
-
after calling `close()`
|
|
19
|
-
|
|
20
|
-
### 0.11.0 / 2016-02-24
|
|
21
|
-
|
|
22
|
-
- Introduce a `net` option to the `Client` class for setting things like, say,
|
|
23
|
-
`servername`
|
|
24
|
-
|
|
25
|
-
### 0.10.0 / 2015-07-08
|
|
26
|
-
|
|
27
|
-
- Add the standard `code` and `reason` parameters to the `close` method
|
|
28
|
-
|
|
29
|
-
### 0.9.4 / 2015-03-08
|
|
30
|
-
|
|
31
|
-
- Don't send input to the driver before `start()` is called
|
|
32
|
-
|
|
33
|
-
### 0.9.3 / 2015-02-19
|
|
34
|
-
|
|
35
|
-
- Make sure the TCP socket is not left open when closing the connection
|
|
36
|
-
|
|
37
|
-
### 0.9.2 / 2014-12-21
|
|
38
|
-
|
|
39
|
-
- Only emit `error` once, and don't emit it after `close`
|
|
40
|
-
|
|
41
|
-
### 0.9.1 / 2014-12-18
|
|
42
|
-
|
|
43
|
-
- Check that all options to the WebSocket constructor are recognized
|
|
44
|
-
|
|
45
|
-
### 0.9.0 / 2014-12-13
|
|
46
|
-
|
|
47
|
-
- Allow protocol extensions to be passed into websocket-extensions
|
|
48
|
-
|
|
49
|
-
### 0.8.1 / 2014-11-12
|
|
50
|
-
|
|
51
|
-
- Send the correct hostname when upgrading a connection to TLS
|
|
52
|
-
|
|
53
|
-
### 0.8.0 / 2014-11-08
|
|
54
|
-
|
|
55
|
-
- Support connections via HTTP proxies
|
|
56
|
-
- Close the connection cleanly if we're still waiting for a handshake response
|
|
57
|
-
|
|
58
|
-
### 0.7.3 / 2014-10-04
|
|
59
|
-
|
|
60
|
-
- Allow sockets to be closed when they are in any state other than `CLOSED`
|
|
61
|
-
|
|
62
|
-
### 0.7.2 / 2013-12-29
|
|
63
|
-
|
|
64
|
-
- Make sure the `close` event is emitted by clients on Node v0.10
|
|
65
|
-
|
|
66
|
-
### 0.7.1 / 2013-12-03
|
|
67
|
-
|
|
68
|
-
- Support the `maxLength` websocket-driver option
|
|
69
|
-
- Make the client emit `error` events on network errors
|
|
70
|
-
|
|
71
|
-
### 0.7.0 / 2013-09-09
|
|
72
|
-
|
|
73
|
-
- Allow the server to send custom headers with EventSource responses
|
|
74
|
-
|
|
75
|
-
### 0.6.1 / 2013-07-05
|
|
76
|
-
|
|
77
|
-
- Add `ca` option to the client for specifying certificate authorities
|
|
78
|
-
- Start the server driver asynchronously so that `onopen` handlers can be added
|
|
79
|
-
|
|
80
|
-
### 0.6.0 / 2013-05-12
|
|
81
|
-
|
|
82
|
-
- Add support for custom headers
|
|
83
|
-
|
|
84
|
-
### 0.5.0 / 2013-05-05
|
|
85
|
-
|
|
86
|
-
- Extract the protocol handlers into the `websocket-driver` library
|
|
87
|
-
- Support the Node streaming API
|
|
88
|
-
|
|
89
|
-
### 0.4.4 / 2013-02-14
|
|
90
|
-
|
|
91
|
-
- Emit the `close` event if TCP is closed before CLOSE frame is acked
|
|
92
|
-
|
|
93
|
-
### 0.4.3 / 2012-07-09
|
|
94
|
-
|
|
95
|
-
- Add `Connection: close` to EventSource response
|
|
96
|
-
- Handle situations where `request.socket` is undefined
|
|
97
|
-
|
|
98
|
-
### 0.4.2 / 2012-04-06
|
|
99
|
-
|
|
100
|
-
- Add WebSocket error code `1011`.
|
|
101
|
-
- Handle URLs with no path correctly by sending `GET /`
|
|
102
|
-
|
|
103
|
-
### 0.4.1 / 2012-02-26
|
|
104
|
-
|
|
105
|
-
- Treat anything other than a `Buffer` as a string when calling `send()`
|
|
106
|
-
|
|
107
|
-
### 0.4.0 / 2012-02-13
|
|
108
|
-
|
|
109
|
-
- Add `ping()` method to server-side `WebSocket` and `EventSource`
|
|
110
|
-
- Buffer `send()` calls until the draft-76 handshake is complete
|
|
111
|
-
- Fix HTTPS problems on Node 0.7
|
|
112
|
-
|
|
113
|
-
### 0.3.1 / 2012-01-16
|
|
114
|
-
|
|
115
|
-
- Call `setNoDelay(true)` on `net.Socket` objects to reduce latency
|
|
116
|
-
|
|
117
|
-
### 0.3.0 / 2012-01-13
|
|
118
|
-
|
|
119
|
-
- Add support for `EventSource` connections
|
|
120
|
-
|
|
121
|
-
### 0.2.0 / 2011-12-21
|
|
122
|
-
|
|
123
|
-
- Add support for `Sec-WebSocket-Protocol` negotiation
|
|
124
|
-
- Support `hixie-76` close frames and 75/76 ignored segments
|
|
125
|
-
- Improve performance of HyBi parsing/framing functions
|
|
126
|
-
- Decouple parsers from TCP and reduce write volume
|
|
127
|
-
|
|
128
|
-
### 0.1.2 / 2011-12-05
|
|
129
|
-
|
|
130
|
-
- Detect closed sockets on the server side when TCP connection breaks
|
|
131
|
-
- Make `hixie-76` sockets work through HAProxy
|
|
132
|
-
|
|
133
|
-
### 0.1.1 / 2011-11-30
|
|
134
|
-
|
|
135
|
-
- Fix `addEventListener()` interface methods
|
|
136
|
-
|
|
137
|
-
### 0.1.0 / 2011-11-27
|
|
138
|
-
|
|
139
|
-
- Initial release, based on WebSocket components from Faye
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var inspect = require('util').inspect;
|
|
2
|
-
|
|
3
|
-
function Headers() {
|
|
4
|
-
var rtn = new Array();
|
|
5
|
-
rtn.__proto__ = Headers.prototype;
|
|
6
|
-
return rtn;
|
|
7
|
-
}
|
|
8
|
-
module.exports = Headers;
|
|
9
|
-
|
|
10
|
-
Headers.prototype.__proto__ = Array.prototype;
|
|
11
|
-
|
|
12
|
-
Headers.prototype._addHeader = function addHeader(line, key, value, index) {
|
|
13
|
-
line = new String(line);
|
|
14
|
-
line.key = key;
|
|
15
|
-
line.value = value;
|
|
16
|
-
this[index] = line;
|
|
17
|
-
this[key] = this[key.toLowerCase()] = value;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// A custom 'inspect' function for util.inspect to use on these mutant
|
|
21
|
-
// header Arrays. Otherwise they're extremely ugly to `console.log`.
|
|
22
|
-
Headers.prototype.inspect = function headerInspect() {
|
|
23
|
-
var len = this.length;
|
|
24
|
-
if (len == 0) return '[]';
|
|
25
|
-
var str = '';
|
|
26
|
-
this.forEach(function(header, i) {
|
|
27
|
-
str += (i == 0 ? '[ ' : ' ') +
|
|
28
|
-
inspect(header.key) + ': ' +
|
|
29
|
-
inspect(header.value) +
|
|
30
|
-
(i != len-1 ? ',\n' : ' ]');
|
|
31
|
-
});
|
|
32
|
-
return str;
|
|
33
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
require('bufferjs');
|
|
2
|
-
var EventEmitter = require('events').EventEmitter;
|
|
3
|
-
var StreamStack = require('stream-stack').StreamStack;
|
|
4
|
-
var BufferList = require('bufferlist');
|
|
5
|
-
var Headers = require('./headers');
|
|
6
|
-
|
|
7
|
-
function Parser(stream, opts) {
|
|
8
|
-
opts = opts || {};
|
|
9
|
-
opts.__proto__ = Parser.DEFAULTS;
|
|
10
|
-
this.stream = stream;
|
|
11
|
-
this.options = opts;
|
|
12
|
-
this._buffers = new BufferList();
|
|
13
|
-
this.headers = new Headers();
|
|
14
|
-
this._firstLineFired = false;
|
|
15
|
-
this._headersFired = false;
|
|
16
|
-
|
|
17
|
-
// We use an internal StreamStack instance, so that the
|
|
18
|
-
// end-user doesn't think that the Parser instance can
|
|
19
|
-
// be `pipe()`ed from.
|
|
20
|
-
var self = this;
|
|
21
|
-
this._parser = new StreamStack(stream, {
|
|
22
|
-
data: function onData(chunk) {
|
|
23
|
-
self._onData(chunk);
|
|
24
|
-
},
|
|
25
|
-
end: function onEnd() {
|
|
26
|
-
self._onEnd();
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
require('util').inherits(Parser, EventEmitter);
|
|
31
|
-
module.exports = Parser;
|
|
32
|
-
|
|
33
|
-
// The default 'options' for the Parser, can be overwritten during construction
|
|
34
|
-
Parser.DEFAULTS = {
|
|
35
|
-
emitFirstLine: false,
|
|
36
|
-
strictCRLF: false,
|
|
37
|
-
strictSpaceAfterColon: false,
|
|
38
|
-
allowFoldedHeaders: false
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
Parser.LF = new Buffer('\n');
|
|
42
|
-
Parser.CRLF = new Buffer('\r\n');
|
|
43
|
-
|
|
44
|
-
// Parsing Logic:
|
|
45
|
-
// - Check if _buffers contains an end-of-line delimiter:
|
|
46
|
-
// - If yes, slice up to the first end-of-line found:
|
|
47
|
-
// - If slice.length === 0, then an empty line was found. Fire the 'headers' event
|
|
48
|
-
// - else if the slice begins with whitespace:
|
|
49
|
-
// - If 'allowFoldedHeaders' is true, then append to the previous header
|
|
50
|
-
// - else if 'allowFoldedHeaders' is false then emit a ParserError.
|
|
51
|
-
// - Else parse the line into the headers array. If _buffers.length > 0, call _onData again
|
|
52
|
-
// - If no, do nothing, wait for next 'data' event
|
|
53
|
-
Parser.prototype._onData = function onData(chunk) {
|
|
54
|
-
if (chunk) this._buffers.push(chunk);
|
|
55
|
-
var buf = this._buffers.take();
|
|
56
|
-
var eol = buf.indexOf(Parser.CRLF);
|
|
57
|
-
var delimLength = Parser.CRLF.length;
|
|
58
|
-
if (eol === -1) {
|
|
59
|
-
eol = buf.indexOf(Parser.LF);
|
|
60
|
-
delimLength = Parser.LF.length;
|
|
61
|
-
if (eol !== -1 && this.options.strictCRLF) {
|
|
62
|
-
return this.emit('error', new Error('ParseError: Found a lone \'\\n\' char, and `strictCRLF` is true'));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (eol !== -1) {
|
|
66
|
-
var slice = buf.slice(0, eol);
|
|
67
|
-
this._buffers.advance(eol+delimLength);
|
|
68
|
-
this._parseHeaderLine(slice.toString());
|
|
69
|
-
if (this._buffers.length > 0) {
|
|
70
|
-
this._onData();
|
|
71
|
-
}
|
|
72
|
-
} else {
|
|
73
|
-
//console.error("waiting for the next 'data' event");
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// If we get the 'end' event before the 'headers' event was fired, then
|
|
78
|
-
// something went wrong with the upstream, and we should emit a parsing error.
|
|
79
|
-
Parser.prototype._onEnd = function onEnd() {
|
|
80
|
-
if (!this._headersFired) {
|
|
81
|
-
return this.emit('error', new Error('ParseError: Got "end" event before the end of headers was found'));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Parses a single line into a key-value header pair, and adds the
|
|
86
|
-
// pair to the 'headers' Array. 'line' is a String.
|
|
87
|
-
Parser.prototype._parseHeaderLine = function parseHeaderLine(line) {
|
|
88
|
-
//console.error("Got header line:");
|
|
89
|
-
//console.error(line);
|
|
90
|
-
if (!this._firstLineFired && this.options.emitFirstLine) {
|
|
91
|
-
this._firstLineFired = true;
|
|
92
|
-
this.emit('firstLine', line);
|
|
93
|
-
} else if (line.length === 0) {
|
|
94
|
-
// An empty line is the end of the headers
|
|
95
|
-
this._onHeadersComplete();
|
|
96
|
-
} else if (line[0] === ' ' || line[0] === '\t') {
|
|
97
|
-
// A line beginning with whitespace is a folded header
|
|
98
|
-
if (!this.options.allowFoldedHeaders) {
|
|
99
|
-
return this.emit('error', new Error('ParseError: Encountered a folded header, but `allowFoldedHeaders` is false'));
|
|
100
|
-
}
|
|
101
|
-
var prevIndex = this.headers.length - 1;
|
|
102
|
-
var prevHeader = this.headers[prevIndex];
|
|
103
|
-
line = line.trimLeft();
|
|
104
|
-
this.headers._addHeader(prevHeader + ' ' + line, prevHeader.key, prevHeader.value + ' ' + line, prevIndex);
|
|
105
|
-
} else {
|
|
106
|
-
// A regular header line, parse like normal
|
|
107
|
-
var firstColon = line.indexOf(':');
|
|
108
|
-
if (firstColon < 1) {
|
|
109
|
-
return this.emit('error', new Error('ParseError: Malformed header line, no delimiter (:) found: "' + line + '"'));
|
|
110
|
-
}
|
|
111
|
-
var spaceAfterColon = line[firstColon+1] === ' ';
|
|
112
|
-
if (!spaceAfterColon && this.options.strictSpaceAfterColon) {
|
|
113
|
-
return this.emit('error', new Error('ParseError: Encountered a header line without a space after the colon, and `strictSpaceAfterColon` is true'));
|
|
114
|
-
}
|
|
115
|
-
var key = line.substring(0, firstColon);
|
|
116
|
-
var value = line.substring(firstColon + (spaceAfterColon ? 2 : 1));
|
|
117
|
-
this.headers._addHeader(line, key, value, this.headers.length);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
Parser.prototype._onHeadersComplete = function onHeadersComplete() {
|
|
123
|
-
this._headersFired = true;
|
|
124
|
-
var leftover;
|
|
125
|
-
if (this._buffers.length > 0) {
|
|
126
|
-
leftover = this._buffers.take();
|
|
127
|
-
this._buffers.advance(leftover.length);
|
|
128
|
-
}
|
|
129
|
-
this._parser.cleanup();
|
|
130
|
-
this.emit('headers', this.headers, leftover);
|
|
131
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
Received: from cm-omr2 (mail.networksolutionsemail.com [205.178.146.50])
|
|
2
|
-
by omr2.networksolutionsemail.com (8.13.6/8.13.6) with ESMTP id p2MHKqUI024119
|
|
3
|
-
for <ilon@viewdar.com>; Tue, 22 Mar 2011 13:20:52 -0400
|
|
4
|
-
Authentication-Results: cm-omr2 smtp.user=ilon@enako.com; auth=pass (CRAM-MD5)
|
|
5
|
-
X-Authenticated-UID: ilon@enako.com
|
|
6
|
-
Received: from [75.220.224.105] ([75.220.224.105:3777] helo=SmartServer)
|
|
7
|
-
by cm-omr2 (envelope-from <ilon@enako.com>)
|
|
8
|
-
(ecelerity 2.2.2.41 r(31179/31189)) with ESMTPA
|
|
9
|
-
id D8/B4-21287-27AD88D4; Tue, 22 Mar 2011 13:20:52 -0400
|
|
10
|
-
Date: Tue, 22 Mar 2011 13:20:50 -0400
|
|
11
|
-
Message-ID: <D8.B4.21287.27AD88D4@cm-omr2>
|
|
12
|
-
From: "mail" <ilon@enako.com>
|
|
13
|
-
To: <ilon@viewdar.com>
|
|
14
|
-
Subject: SLC: HeartBeat
|
|
15
|
-
X-Mailer: i.LON Mailer V4.3
|
|
16
|
-
MIME-Version: 1.0
|
|
17
|
-
Content-Type: multipart/mixed; boundary=ILON100
|
|
18
|
-
|
|
19
|
-
If you can read this, check your email client!
|
|
20
|
-
|
|
21
|
-
--ILON100
|
|
22
|
-
Content-Type: text/plain; charset=utf-8
|
|
23
|
-
Content-Transfer-Encoding: 8bit
|
|
24
|
-
|
|
25
|
-
~~DCC:SLC~~DAT:2011-03-22~~TIM:11:21:01~~ALM:HEARTBEAT~~
|
|
26
|
-
|
|
27
|
-
--ILON100--
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var assert = require('assert');
|
|
2
|
-
var Stream = require('stream').Stream;
|
|
3
|
-
var Parser = require('../parser');
|
|
4
|
-
|
|
5
|
-
var body = new Buffer("test:1\r\n\r\nleftover");
|
|
6
|
-
var stream = new Stream();
|
|
7
|
-
|
|
8
|
-
var parser = new Parser(stream);
|
|
9
|
-
parser.on('headers', function(headers, leftover) {
|
|
10
|
-
console.log(headers);
|
|
11
|
-
console.log(leftover, leftover+'');
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
stream.emit('data', body);
|
|
15
|
-
stream.emit('end');
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
var fs = require('fs');
|
|
2
|
-
var assert = require('assert');
|
|
3
|
-
var Parser = require('../parser');
|
|
4
|
-
|
|
5
|
-
var stream = fs.createReadStream(__dirname + '/dumps/multipart-folded-headers.eml', {
|
|
6
|
-
//bufferSize: 1
|
|
7
|
-
});
|
|
8
|
-
var parser = new Parser(stream, {
|
|
9
|
-
strictCRLF: true,
|
|
10
|
-
allowFoldedHeaders: true
|
|
11
|
-
});
|
|
12
|
-
var gotHeaders = false;
|
|
13
|
-
parser.on('headers', function (headers, leftover) {
|
|
14
|
-
console.log(headers);
|
|
15
|
-
|
|
16
|
-
gotHeaders = true;
|
|
17
|
-
assert.equal(headers[0].value, 'from cm-omr2 (mail.networksolutionsemail.com [205.178.146.50]) by omr2.networksolutionsemail.com (8.13.6/8.13.6) with ESMTP id p2MHKqUI024119 for <ilon@viewdar.com>; Tue, 22 Mar 2011 13:20:52 -0400');
|
|
18
|
-
});
|
|
19
|
-
process.on('exit', function() {
|
|
20
|
-
assert.ok(gotHeaders);
|
|
21
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var fs = require('fs');
|
|
2
|
-
var assert = require('assert');
|
|
3
|
-
var Parser = require('../parser');
|
|
4
|
-
|
|
5
|
-
var stream = fs.createReadStream(__dirname + '/dumps/simple-curl-get.dump');
|
|
6
|
-
var parser = new Parser(stream, {
|
|
7
|
-
emitFirstLine: true,
|
|
8
|
-
strictCRLF: true
|
|
9
|
-
});
|
|
10
|
-
var gotFirstLine = false;
|
|
11
|
-
parser.on('firstLine', function (line) {
|
|
12
|
-
gotFirstLine = true;
|
|
13
|
-
console.error('First Line:', line);
|
|
14
|
-
assert.equal(line, 'GET / HTTP/1.1');
|
|
15
|
-
});
|
|
16
|
-
var gotHeaders = false;
|
|
17
|
-
parser.on('headers', function (headers, leftover) {
|
|
18
|
-
gotHeaders = true;
|
|
19
|
-
console.error('Headers:', headers);
|
|
20
|
-
assert.equal(headers.length, 3);
|
|
21
|
-
assert.equal(headers['User-Agent'], 'curl/7.21.0 (i686-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18');
|
|
22
|
-
assert.equal(headers.host, 'localhost:8080');
|
|
23
|
-
assert.equal(headers[2], 'Accept: */*')
|
|
24
|
-
assert.equal(headers[2].key, 'Accept');
|
|
25
|
-
assert.equal(headers[2].value, '*/*')
|
|
26
|
-
console.error(leftover);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
process.on('exit', function () {
|
|
30
|
-
assert.ok(gotFirstLine);
|
|
31
|
-
assert.ok(gotHeaders);
|
|
32
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-

|
|
2
|
-

|
|
3
|
-
|
|
4
|
-
# HTTP Parser
|
|
5
|
-
|
|
6
|
-
This library parses HTTP protocol for requests and responses.
|
|
7
|
-
It was created to replace `http_parser.c` since calling C++ functions from JS is really slow in V8.
|
|
8
|
-
However, it is now primarily useful in having a more flexible/tolerant HTTP parser when dealing with legacy services that do not meet the strict HTTP parsing rules Node's parser follows.
|
|
9
|
-
|
|
10
|
-
This is packaged as a standalone npm module.
|
|
11
|
-
To use in node, monkeypatch HTTPParser.
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
// Monkey patch before you require http for the first time.
|
|
15
|
-
process.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser;
|
|
16
|
-
|
|
17
|
-
var http = require('http');
|
|
18
|
-
// ...
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Testing
|
|
22
|
-
|
|
23
|
-
Simply run `npm test`.
|
|
24
|
-
The tests are copied from node and mscedex/io.js, with some modifcations.
|
|
25
|
-
|
|
26
|
-
## Status
|
|
27
|
-
|
|
28
|
-
This should now be usable in any node application, it now supports (nearly) everything `http_parser.c` does while still being tolerant with corrupted headers, and other kinds of malformed data.
|
|
29
|
-
|
|
30
|
-
### Node versions
|
|
31
|
-
|
|
32
|
-
`http-parser-js` should work via monkey-patching on Node v6-v11, and v13-14.
|
|
33
|
-
|
|
34
|
-
Node v12.x renamed the internal http parser, and did not expose it for monkey-patching, so to be able to monkey-patch on Node v12, you must run `node --http-parser=legacy file.js` to opt in to the old, monkey-patchable http_parser binding.
|
|
35
|
-
|
|
36
|
-
## Standalone usage
|
|
37
|
-
|
|
38
|
-
While this module is intended to be used as a replacement for the internal Node.js parser, it can be used as a standalone parser. The [`standalone-example.js`](standalone-example.js) demonstrates how to use the somewhat awkward API (coming from compatibility with the Node.js internals) to parse HTTP from raw Buffers.
|
|
39
|
-
|
|
40
|
-
## License
|
|
41
|
-
|
|
42
|
-
MIT.
|
|
43
|
-
See [LICENSE.md](LICENSE.md)
|