Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Also added stubs for Server.address()
This was done to prevent crashes in some popular frameworks like express
Supports both CommonJS and the new ES Modules system syntax e.g:
app.js:
const http = require('http')
app.mjs:
import http from "http"
Usage on Node 14.16.x and higher:
{
"type": "external",
"processes": {"spare": 0},
"working_directory": '/project',
"executable": "/usr/bin/env",
"arguments": [
"node",
"--loader",
"unit-http/require_shim.mjs"
"--require",
"unit-http/require_shim",
"app.js"
]
}
Usage on Node 14.15.x and lower:
{
"type": "external",
"processes": {"spare": 0},
"working_directory": '/project',
"executable": "/usr/bin/env",
"arguments": [
"node",
"--require",
"unit-http/require_shim",
"app.js"
]
}
|
|
This makes the "sed" instruction simpler and more portable, as the previous
variant didn't work well on BSD systems due to the "\s" metacharacter.
Thanks to Sergey A. Osokin <osa@FreeBSD.org.ru> for spotting this issue.
Also, this should prevent accidentally creating a version 1.0.0 package.
|
|
This partially reverts the optimisation introduced in 1d84b9e4b459 to avoid an
unpredictable block in nxt_unit_process_port_msg(). Under high load, this
function may never return control to its caller, and the external event loop
(in Node.js and Python asyncio) won't be able to process other scheduled
events.
To reproduce the issue, two request processing types are needed: 'fast' and
'furious'. The 'fast' one simply returns a small response, while the 'furious'
schedules asynchronous calls to external resources. Thus, if Unit is subjected
to a large amount of 'fast' requests, the 'furious' request processing freezes
until the high load ends.
The issue was found by Wu Jian Ping (@wujjpp) during Node.js stream
implementation discussion and relates to PR #502 on GitHub.
|
|
ServerRequest now inherit stream Readable object. ServerResponse
provides 'writable' property.
Thanks to Wu Jian Ping (@wujjpp).
This closes #274, closes #317 issues and closes #502 PR on GitHub.
|
|
This fixes a crash on exit of Node.js application. The crash reproduced
on Ubuntu 20.10 with Node.js v15.1.0. Tests 'test_node_websockets_two_clients'
and 'test_node_websockets_7_13_1__7_13_2'.
The reason of the crash is using request struct which was already freed.
The issue was introduced in 5be509fda29e.
|
|
Warnings changed for debug messages.
|
|
|
|
This is the port shared between all application processes which use it to pass
requests for processing. Using it significantly simplifies the request
processing code in the router. The drawback is 2 more file descriptors per each
configured application and more complex libunit message wait/read code.
|
|
- Changed the port management callbacks to notifications, which e. g. avoids
the need to call the libunit function
- Added context and library instance reference counts for a safer resource
release
- Added the router main port initialization
|
|
According to libuv documentation, uv_poll_t memory should be released
in a callback function passed to uv_close(). Otherwise, the Node.js application
process may crash at exit.
|
|
This is required for Express framework compatibility.
This closes #418 issue on GitHub.
|
|
|
|
|
|
ServerResponse.write() method tries to write data buffer using libunit
and stores buffers to write in a Server-wide output queue, which is
processed in response to SHM_ACK message from router.
As a side effect 'drain' event implemented and socket.writable flag
reflect current state.
|
|
Name and value in each header are 0-terminated, so additional 2 bytes
should be allocated for them. There were several attempts to add these
2 bytes to headers in language modules, but some modules weren't updated.
Also, adding these 2 bytes is specific to the implementation which may be
changed later, so extending this mechanics to modules may cause errors.
|
|
|
|
In Node.js version 11.10.0 and later, the writeHead() function returns "this".
|
|
File nxt_napi.h (introduced in 53533ba0097c) added into packaged files
list.
This closes #261 issue on GitHub.
|
|
Node.js modules (body-parser, row-body) search low-cased names
('content-length', 'content-type' etc.) to properly assemble request body.
This closes #246 issue on GitHub.
|
|
This closes #240 issue on GitHub.
|
|
Warnings introduced in 53533ba0097c commit.
|
|
Adding actual 'remoteAddress' and 'localAddress' into socket object.
This closes #232 issue on GitHub.
|
|
This closes #236 on GitHub.
Thanks to 0xcdcdcdcd.
|
|
With exceptions and overloads.
|
|
|
|
This also eliminates expressions that incompatible with BSD make, thus fixing
installation of Node.js module on FreeBSD (broken by dace60fc4926).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
No functional changes.
|
|
Third-party file descriptors are not supported.
Socket "readable" and "writable" options are set true by default.
|
|
The sequence of napi_open_callback_scope(),
napi_call_function(), and napi_close_callback_scope() functions calls
executes the provided JS code and all functions enqueued by
process.nextTick() and Promises during this execution.
|
|
The problem is caused by Promises' inconsistency.
The 'date' event could have been triggered before the user has started
listening for it. To resolve the issue, we override the 'on' method of
the request's emitter.
|
|
|
|
|
|
|
|
|
|
This fixes two issues:
- values for mutiple header fields with the same name
passed as arrays were converted to string;
- the type of field value wasn't preserved as required
by specification.
|
|
Node.js processes didn't exit after the changes in b9f7635e6be2,
as the quit command from port wasn't handled by the module.
|
|
We increase the number to the Unit object so that it lives forever.
This is necessary so that the garbage collector does not delete the Unit object.
|
|
- Fixed handling of the "options" parameter in Socket() constructor;
- Now the connect() method returns "this";
- Deduplicated the address() method;
- Added missing "callback" argument to the end() method;
- Now the destroy() method returns "this";
- Added "timeout" argument type check in the setTimeout() method.
|
|
|
|
|
|
|
|
|