Fixes#2216
This was broken when we switched from media-typer to content-type
modules for parsing the content-type header.
The content-type header can handle the field with parameters, but
does not do the type/sub-type parsing that media-typer does.
Our code relied on that extra bit of parsing to correctly
identify if the content should be parsed to String or kept as
a buffer.
The fix restores the use of media-typer, but using the result
of the content-type module to make sure it valid
The way we dynamically added/removed event handlers for the
upgrade event was causing problems with the way sockjs (as
used by the worldmap node) tries to intercept the event.
This fix means the ws nodes won't ever remove the upgrade
listener - it gets added once when the first ws node is
deployed and will then remain until the last ws node is
removed and the runtime restarted.
* Authentication methods
* Authentication methods
* Authentication methods
* Support undefined auth type
* Support undefined auth type
* Apply basic auth on existing nodes
* Use password as bearer token
* Use password as bearer token
* Switch between password/token labels
* Bearer token abbreviation
* Separate token span
Closes#1747
This was inspired by a PR from @mauriciom75 but implemented in a different way
due to some of the internal reworking done to Flow and Subflow in the dev branch
Significant update to the ws module to get it completely up to date.
The jump from 1.x to 6.x has required a rewrite of our WS handling. Most
specifically the means by which you can have multiple ws servers on a
single http server has completely changed; we now have to handle the
'upgrade' event on the server ourselves.
Promises are expensive and should not be used in the main
message handling path. The Switch node used them a lot if
the node references context - with a lot of duplicate code
to handle async and sync code paths.
This change modifies the code to use callbacks throughout
that are just as performant in either case.