-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[major] No longer use the binary addons as optional dependency, nuked…
… completely
- Loading branch information
Showing
1 changed file
with
3 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49b1109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this mess up UTF-8 validation, though? I'm guessing that since
utf-8-validate
is now a dev dependency, the Autobahn tests would pass normally, but when you actually install the library, UTF-8 validation wouldn't work as expected, since the fallback returnstrue
unconditionally...49b1109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
49b1109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the module be fixed (at least in theory), or is there another module that can replace it?
49b1109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If anything, websockets/utf-8-validate#23 seems to be a decent fallback.
49b1109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
49b1109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it can't do UTF8 validation, Node.js at least knows when to replace invalid UTF8 characters with U+FFFD (
REPLACEMENT CHARACTER
). TheBuffer.compare(new Buffer(buff.toString(),'utf8') , buff) === 0
workaround is an indirect validation, of sorts.I ran the Autobahn fuzzingclient suite for the
6.*
tests, and it passed them all with the proposed workaround, whereas thereturn true
function fails the tests where Autobahn sends invalid UTF-8 data.I would consider that unexpected/inconsistent behavior, though. If the RFC says the implementation has to drop the connection, then I'd assume you have to drop the connection. If you had, say, a chat application that basically broadcasted whatever message someone sent to a chat room, I'd honestly prefer it to only broadcast message that has U+FFFDs in them when explicitly requested in valid UTF-8 form.
49b1109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note: A native UTF8 validator is in progress in Node: nodejs/node#1319
49b1109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This broke my setup because I only have python 3 and node-gyp isn't compatible with it. Any way we can get this reverted?
I ended up added
bufferutil
as an optionalDependency in my own packages.json which seems to override it49b1109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is how to fallback with it:
https://github.com/websockets/bufferutil/blob/master/fallback.js
49b1109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the installation still fails when these fail to install as optional dependencies, doesn't that mean we have found a bug in npm? npm's own site says that installation failures of individual optional dependencies should not cause the entire npm install operation to fail.