Commit Graph

25 Commits

Author SHA1 Message Date
Max Romanov
55296e6ff2 Node.js: removing unnecessary warnings.
Warnings changed for debug messages.
2020-11-30 23:30:20 +03:00
Max Romanov
6c3c83561a Libunit: closing active requests on quit. 2020-11-18 22:33:53 +03:00
Max Romanov
8359560612 Introducing the shared application port.
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.
2020-08-11 19:20:15 +03:00
Max Romanov
ec3389b63b Libunit refactoring: port management.
- 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
2020-08-11 19:19:55 +03:00
Max Romanov
375cbc2cc4 Node.js: correct port data memory release.
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.
2020-08-07 15:06:24 +03:00
Max Romanov
004ab48a9e Node.js: fixing x86 warning about the signed/unsigned comparison. 2020-03-03 18:28:16 +03:00
Max Romanov
1451090d85 Node.js: suppress compilation warning. 2020-01-28 17:06:57 +03:00
Max Romanov
763bdff401 Node.js: implementing output message drain using SHM_ACK feature.
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.
2019-12-24 18:04:17 +03:00
Max Romanov
f2610d2160 Fixing libunit 'off by 2' issue in library.
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.
2019-11-11 18:04:17 +03:00
Max Romanov
e291841b33 Node.js: introducing websocket support. 2019-08-20 16:32:05 +03:00
Max Romanov
c6e96647a1 Node.js: using low-case header names as key in req.headers.
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.
2019-04-17 19:15:41 +03:00
Max Romanov
6241099db2 Removing unused variables and assignments.
Warnings introduced in 53533ba0097c commit.
2019-04-02 16:07:49 +03:00
Max Romanov
56101e47ee Adding 'connection' to request as an alias to 'socket'.
Adding actual 'remoteAddress' and 'localAddress' into socket object.

This closes #232 issue on GitHub.
2019-04-01 16:40:49 +03:00
Max Romanov
8557cb3660 Introducing close event to notify about server stop.
This closes #236 on GitHub.
Thanks to 0xcdcdcdcd.
2019-04-01 16:40:40 +03:00
Max Romanov
aca42de18a Adding syntax sugar.
With exceptions and overloads.
2019-04-01 16:40:33 +03:00
Andrey Zelenkov
22de5fcddf Style. 2019-03-11 17:31:59 +03:00
Alexander Borisov
ab461437b5 Node.js: checking for exception after running JS code from C++. 2018-12-19 15:56:37 +03:00
Alexander Borisov
dcf51274ce Node.js: checking uniqueness of HTTP headers for different case. 2018-12-19 15:56:30 +03:00
Alexander Borisov
f47a5db506 Node.js: napi_call_function() replaced with napi_make_callback().
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.
2018-12-19 15:56:01 +03:00
Alexander Borisov
fb18a09cd7 Node.js: fixed handling of response header fields.
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.
2018-11-15 15:21:52 +03:00
Alexander Borisov
06b404feb1 Node.js: added correct exit processing.
Node.js processes didn't exit after the changes in b9f7635e6be2,
as the quit command from port wasn't handled by the module.
2018-11-15 15:39:34 +03:00
Alexander Borisov
71f4cb9134 Node.js: added reference count increment for the Unit object.
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.
2018-11-15 15:24:45 +03:00
Andrey Zelenkov
b7442743cf Node.js: fixed typo in naming rawHeaders() method of request. 2018-11-01 19:10:32 +03:00
Alexander Borisov
c838c3bd15 Node.js: added async request execution. 2018-10-31 15:51:51 +03:00
Alexander Borisov
ea62327b00 Added Node.js support. 2018-10-03 17:50:03 +03:00