]>
git.kaiwu.me - njs.git/log
Igor Sysoev [Sat, 6 Oct 2018 14:52:40 +0000 (17:52 +0300)]
Updated documentation link.
Dmitry Volyntsev [Thu, 4 Oct 2018 17:45:40 +0000 (20:45 +0300)]
Stream: fixed counting pending events.
Previously, erroneous messages 'pending events' were reported
to error log.
Dmitry Volyntsev [Thu, 4 Oct 2018 17:43:25 +0000 (20:43 +0300)]
Stream: fixed s.off().
Previously, s.off() did not delete the event in njs vm
using njs_vm_del_event().
Dmitry Volyntsev [Wed, 3 Oct 2018 12:38:19 +0000 (15:38 +0300)]
Fixed default implementation for nxt_explicit_memzero().
Thanks to David CARLIER.
Dmitry Volyntsev [Wed, 3 Oct 2018 12:36:36 +0000 (15:36 +0300)]
Removed useless casting to void for explicit_bzero().
Dmitry Volyntsev [Tue, 2 Oct 2018 17:34:30 +0000 (20:34 +0300)]
Improved time zone tests for Date object.
On some platforms, for example Alpine Linux, non-UTC timezones are
unavailable.
The fix is to use UTC timezone by default, and use a separate test suite
for the original timezone if it is available.
Dmitry Volyntsev [Tue, 2 Oct 2018 17:33:14 +0000 (20:33 +0300)]
Added nxt_memset().
Dmitry Volyntsev [Tue, 2 Oct 2018 17:28:10 +0000 (20:28 +0300)]
Added nxt_memzero() and nxt_explicit_memzero().
Thanks to David CARLIER.
Dmitry Volyntsev [Thu, 27 Sep 2018 14:37:55 +0000 (17:37 +0300)]
Fixed http response and parent getters.
Getters are expected to set resulting value to the provided
argument, not to vm->retval.
Dmitry Volyntsev [Thu, 27 Sep 2018 14:36:38 +0000 (17:36 +0300)]
Fixed code size mismatch error message.
Dmitry Volyntsev [Wed, 19 Sep 2018 16:36:00 +0000 (19:36 +0300)]
Fixed http status and contentType getter.
Getter are expected to set resulting value to provied
argument, not to vm->retval.
Dmitry Volyntsev [Wed, 19 Sep 2018 16:24:07 +0000 (19:24 +0300)]
Fixed njs_array_alloc() for length > 2**31.
Dmitry Volyntsev [Wed, 19 Sep 2018 16:24:05 +0000 (19:24 +0300)]
Fixed Array.prototype.length setter.
Dmitry Volyntsev [Wed, 19 Sep 2018 11:43:58 +0000 (14:43 +0300)]
Version bump.
Dmitry Volyntsev [Tue, 18 Sep 2018 12:14:06 +0000 (15:14 +0300)]
Added tag 0.2.4 for changeset
3e6c38f64bdb
Dmitry Volyntsev [Tue, 18 Sep 2018 12:13:41 +0000 (15:13 +0300)]
Version 0.2.4.
Dmitry Volyntsev [Mon, 17 Sep 2018 15:47:00 +0000 (18:47 +0300)]
Fixed String.slice() for undefined arguments.
Dmitry Volyntsev [Fri, 14 Sep 2018 11:19:03 +0000 (14:19 +0300)]
Fixed njs_string_slice().
dst retval argument was ignored.
Dmitry Volyntsev [Thu, 13 Sep 2018 15:46:02 +0000 (18:46 +0300)]
Added njs_uint32_to_string().
Dmitry Volyntsev [Thu, 13 Sep 2018 12:52:17 +0000 (15:52 +0300)]
Introduced sandboxing mode.
Thanks to David CARLIER.
Dmitry Volyntsev [Tue, 11 Sep 2018 12:35:27 +0000 (15:35 +0300)]
Fixed macro for aligned size of njs_frame_t struct.
NJS_FRAME_SIZE did not take into account the variable length of
closures array. This can result in overlapping addresses for
native_frame->arguments and frame->closures[n],
Dmitry Volyntsev [Tue, 11 Sep 2018 12:34:50 +0000 (15:34 +0300)]
Nginx stream module refactored.
The module handlers are refactored to make them similar to the HTTP
ones. This change is not backward compatible with the existing njs code.
To allow asynchronous operations the model of evaluation of njs handlers
is changed. A handler function (which is set for a corresponding nginx
directive) is invoked only once. It can register a callback if more data
is necessary, by calling s.on(<event_name>, <callback>). Available
events:
upload - new data from a client.
download - new data from an upstream.
Callback prototype:
callback(data, flags).
data - string.
flags - object.
Available properties:
last - boolean, data is a last buffer.
A callback can be deregistered by s.off(<event_name>).
Return codes are replaced with special methods: s.allow(), s.deny(),
s.done().
s.done([code]) (s.OK), can be used to return arbitrary code.
s.allow() (s.OK)
s.deny() (s.ABORT)
In addition, s.decline() method is added to allow handlers to stop
processing of the current handler and pass control to the next
handler of the current phase.
A handler is expected to invoke one of these methods when the
processing is done.
For example js_preread can wait for additional data by registering
a callback which will be called whenever new incoming data appears.
function js_preread(s) {
s.on('upload', function(data, flags) {
// process data
// to proceed to the next phase
s.done()
// to proceed to next handler
// of the current phase
s.decline()
})
}
js_filter handler is refactored.
1) The current data chunk is moved from s.buffer to
the callback argument.
2) s.fromUpstream is removed.
3) The properties related to the current data chunk
(s.eof) are put into the second callback argument.
s.eof is renamed to flags.last.
3) s.send(data[, opts]) is added to replace s.buffer = data;
opts - object, can be used to override nginx buffer flags
derived from an incoming data chunk buffer.
It can contain boolean flags: last, flush.
4) data toward corresponding direction is not forwarded
if a callback is active, a callback is expected to
call s.send(data, flags) if it wants to pass data
as is.
5) s.send() can be called multiple times per callback invocation.
function stream_filter(s) {
s.on('upload', function (data, flags) {
// process a data chunk from a client
// stop filtering data
s.off('upload')
})
s.on('download', function (data, flags) {
// process data from upstream
// send my_data as the last buffer.
s.send(my_data, {last:1});
})
}
Dmitry Volyntsev [Tue, 11 Sep 2018 12:34:48 +0000 (15:34 +0300)]
Added njs_vm_object_alloc().
Dmitry Volyntsev [Tue, 11 Sep 2018 12:34:25 +0000 (15:34 +0300)]
Allowing to create repeatable events.
njs_vm_add_event() prototype is extended to allow creating
oneshot vs repeatable events.
Dmitry Volyntsev [Mon, 3 Sep 2018 11:29:52 +0000 (14:29 +0300)]
Fixed compilation with gcc 4.4.
This fixes #49 issue on Github.
Dmitry Volyntsev [Fri, 31 Aug 2018 13:55:35 +0000 (16:55 +0300)]
Improved wording for InternalError messages.
Dmitry Volyntsev [Thu, 30 Aug 2018 17:21:43 +0000 (20:21 +0300)]
Improved handling of traps inside trap handlers.
Dmitry Volyntsev [Thu, 30 Aug 2018 17:21:18 +0000 (20:21 +0300)]
Fixed comparison of objects and strings.
Dmitry Volyntsev [Thu, 30 Aug 2018 14:21:51 +0000 (17:21 +0300)]
Improved Object.prototype.toString for invalid values.
Dmitry Volyntsev [Wed, 29 Aug 2018 17:32:11 +0000 (20:32 +0300)]
Fixed Object() constructor for object types arguments.
Dmitry Volyntsev [Wed, 29 Aug 2018 17:31:43 +0000 (20:31 +0300)]
Fixed Object.prototype.toString for different value types.
Dmitry Volyntsev [Tue, 28 Aug 2018 15:42:43 +0000 (18:42 +0300)]
Fixed exception handling in arguments of a function.
Dmitry Volyntsev [Tue, 28 Aug 2018 12:37:14 +0000 (15:37 +0300)]
Fixed out-of-bounds read.
Found by Coverity (CID
1438786 ).
Dmitry Volyntsev [Mon, 27 Aug 2018 16:19:25 +0000 (19:19 +0300)]
Added Function.prototype.length.
Dmitry Volyntsev [Mon, 27 Aug 2018 13:37:42 +0000 (16:37 +0300)]
Respecting writable attribute for property handlers.
Dmitry Volyntsev [Mon, 27 Aug 2018 13:37:35 +0000 (16:37 +0300)]
Respecting the enumerable attribute while iterating by for in.
Dmitry Volyntsev [Mon, 27 Aug 2018 13:23:08 +0000 (16:23 +0300)]
Fixed Object.defineProperty() for existing properties.
This fixes #46 issues on Github.
Dmitry Volyntsev [Mon, 27 Aug 2018 13:06:33 +0000 (16:06 +0300)]
Fixed toString() for -0.
Dmitry Volyntsev [Mon, 27 Aug 2018 11:59:59 +0000 (14:59 +0300)]
Throwing TypeError for attempts to change frozen properties.
This fixes #35 issue on Github.
Dmitry Volyntsev [Mon, 20 Aug 2018 15:58:03 +0000 (18:58 +0300)]
Improved wording for primitive type conversion exception.
Dmitry Volyntsev [Thu, 2 Aug 2018 16:39:55 +0000 (19:39 +0300)]
Setting exception values where appropriate.
This fixes #42 issue on Github.
Dmitry Volyntsev [Wed, 1 Aug 2018 15:37:15 +0000 (18:37 +0300)]
Returning an internal error for not-implemented Function().
This fixes #41 issue on GitHub.
Dmitry Volyntsev [Wed, 1 Aug 2018 15:05:01 +0000 (18:05 +0300)]
Adding const qualifiers njs_value_t arguments of public methods.
This allows to use the result of safe njs_arg() macro in the
methods.
Dmitry Volyntsev [Tue, 31 Jul 2018 18:11:44 +0000 (21:11 +0300)]
Fixed error code typo introduced in
5f00966ffff8 .
Dmitry Volyntsev [Tue, 31 Jul 2018 12:30:01 +0000 (15:30 +0300)]
Improved JSON.stringify() for external values.
Dmitry Volyntsev [Tue, 31 Jul 2018 11:45:16 +0000 (14:45 +0300)]
Added tag 0.2.3 for changeset
e83f41520613
Dmitry Volyntsev [Tue, 31 Jul 2018 11:33:01 +0000 (14:33 +0300)]
Version bump.
Dmitry Volyntsev [Tue, 31 Jul 2018 11:32:34 +0000 (14:32 +0300)]
Version 0.2.3.
Dmitry Volyntsev [Mon, 30 Jul 2018 17:00:31 +0000 (20:00 +0300)]
Fixed applying call() to methods of external values.
This correctly fixes #20 on Github.
Dmitry Volyntsev [Mon, 30 Jul 2018 17:00:20 +0000 (20:00 +0300)]
Making njs_arg() available for external value methods.
Dmitry Volyntsev [Fri, 27 Jul 2018 14:01:52 +0000 (17:01 +0300)]
Added the pretty string representation for values.
Interactive shell: dumping the pretty string representation of
the last expression.
>> [1, new Number(2), {a: new String('αβZγ')}, true, console.log,
/^undef$/m, new Date(0)]
[
1,
[Number: 2],
{
a: [String: 'αβZγ']
},
true,
[Function: native],
/^undef$/m,
1970-01-01T00:00:00.000Z
]
njs.dump(value[, indent]):
Returns the pretty string representation of a value.
value - a value of any type.
indent - a number.
A number of space characters per indentation level.
njs.dump({a:[]}) -> '{a:[]}'
njs.dump({a:[]}, 1) -> '{\n a: [\n \n ]\n}'
console.log([value1[, values]])
Prints to stdout the flat pretty string representation
of values (no new lines).
console.dump([value1[, values]])
Prints to stdout the pretty string representation of values.
This fixes #11 issue on GitHub.
Igor Sysoev [Tue, 24 Jul 2018 16:50:02 +0000 (19:50 +0300)]
Fixed addition operator applied to an object.
This fixes #36 issue on Github.
Igor Sysoev [Tue, 24 Jul 2018 16:50:02 +0000 (19:50 +0300)]
Refactored trap infrastructure.
This change allows to introduce virtually unlimited number of traps.
Igor Sysoev [Tue, 24 Jul 2018 16:50:02 +0000 (19:50 +0300)]
Removed artifacts left after changeset
25bd2742a18b .
Valentin Bartenev [Tue, 24 Jul 2018 16:25:39 +0000 (19:25 +0300)]
Fixed configure process with non-default locale.
Overriding LANG might not work, since it has less precedence than LC_* settings.
LC_ALL has the highest precedence.
Dmitry Volyntsev [Tue, 24 Jul 2018 15:29:25 +0000 (18:29 +0300)]
Fixed typo in njs_arg_type_string() for NJS_DATE_ARG.
Dmitry Volyntsev [Mon, 23 Jul 2018 15:04:53 +0000 (18:04 +0300)]
Restricted usage of r.subrequest() and r.parent.
Thanks to 洪志道 (Hong Zhi Dao).
Dmitry Volyntsev [Mon, 23 Jul 2018 13:35:32 +0000 (16:35 +0300)]
Backed out changeset
552da720e6e6 .
The original code was correct, the (int) casting does not change
anything because the type of the '0' literal is int. The solution to the
original problem is to mark CID
1438046 as false-positive.
Dmitry Volyntsev [Fri, 20 Jul 2018 17:11:02 +0000 (20:11 +0300)]
Improved help desrcription of njs shell.
Dmitry Volyntsev [Fri, 20 Jul 2018 13:09:50 +0000 (16:09 +0300)]
Silenced Coverity false-positive warning (CID
1438046 ).
Dmitry Volyntsev [Fri, 20 Jul 2018 12:59:59 +0000 (15:59 +0300)]
Fixed compilation by gcc 4.2.
Dmitry Volyntsev [Thu, 19 Jul 2018 15:11:52 +0000 (18:11 +0300)]
Fixed Number.toString().
Adding correct dtoa() and strtod() realization.
This fixes #28 and #30 issues on GitHub.
Dmitry Volyntsev [Wed, 18 Jul 2018 12:41:55 +0000 (15:41 +0300)]
String.bytesFrom() method.
The method creates a byte string from an array containing octets:
String.bytesFrom(array).
The method creates a byte string from an encoded string:
String.bytesFrom(string, encoding)
where encoding are "hex", "base64", "base64url".
This closes #2 issue on Github.
Dmitry Volyntsev [Tue, 17 Jul 2018 17:25:47 +0000 (20:25 +0300)]
Fixed exception handling in njs_vm_value_to_ext_string().
Sergey Kandaurov [Mon, 16 Jul 2018 11:30:41 +0000 (14:30 +0300)]
Added getentropy() support.
Sergey Kandaurov [Mon, 16 Jul 2018 11:21:09 +0000 (14:21 +0300)]
Supplied getrandom() test with commentary about supported OSes.
Sergey Kandaurov [Mon, 16 Jul 2018 11:20:16 +0000 (14:20 +0300)]
Style.
Dmitry Volyntsev [Fri, 13 Jul 2018 12:12:11 +0000 (15:12 +0300)]
Returning MemoryError exception without any allocations.
Dmitry Volyntsev [Thu, 12 Jul 2018 12:24:18 +0000 (15:24 +0300)]
Interactive shell: improved error handling.
Previously, compilation errors were not reported in file mode.
Igor Sysoev [Tue, 3 Jul 2018 12:48:04 +0000 (15:48 +0300)]
Style fixes.
Igor Sysoev [Tue, 3 Jul 2018 12:48:03 +0000 (15:48 +0300)]
Added information about illegal token in number parsing.
Dmitry Volyntsev [Tue, 3 Jul 2018 11:15:29 +0000 (14:15 +0300)]
Fixed Number() with boolean, null and undefined arguments.
This fixes #25 issue on GitHub.
Dmitry Volyntsev [Mon, 2 Jul 2018 15:03:43 +0000 (18:03 +0300)]
Improved file mode in CLI.
Reporting of the return value of the last expression is disabled.
Unknown [Tue, 26 Jun 2018 11:30:10 +0000 (18:30 +0700)]
Returning external methods as native Function objects.
This fixes #20 issue on GitHub.
Unknown [Tue, 26 Jun 2018 11:27:33 +0000 (18:27 +0700)]
Adding support for multiple arguments in console.log().
Valentin Bartenev [Fri, 29 Jun 2018 19:36:41 +0000 (22:36 +0300)]
String.padStart() and String.padEnd() methods.
Dmitry Volyntsev [Mon, 2 Jul 2018 13:10:52 +0000 (16:10 +0300)]
Fixed autocompletion for global objects.
This fixes #23 issue on GitHub.
Valentin Bartenev [Sun, 1 Jul 2018 07:01:53 +0000 (10:01 +0300)]
Added support of binary literals.
Valentin Bartenev [Sun, 1 Jul 2018 06:59:45 +0000 (09:59 +0300)]
Allowed uppercased O in octal literal values.
Valentin Bartenev [Sat, 30 Jun 2018 17:39:22 +0000 (20:39 +0300)]
Fixed error handling of setting non-numeric Array.length.
Dmitry Volyntsev [Thu, 28 Jun 2018 14:04:18 +0000 (17:04 +0300)]
Adding lib_test to generic test target.
Sergey Kandaurov [Thu, 28 Jun 2018 11:37:25 +0000 (14:37 +0300)]
Fixed building unit tests after nxt_length() expansion.
Valentin Bartenev [Tue, 26 Jun 2018 15:25:22 +0000 (18:25 +0300)]
Introduced nxt_length() macro.
Dmitry Volyntsev [Tue, 19 Jun 2018 11:07:22 +0000 (14:07 +0300)]
Version bump.
Dmitry Volyntsev [Tue, 19 Jun 2018 11:05:18 +0000 (14:05 +0300)]
Added tag 0.2.2 for changeset
4adbb035caa3
Dmitry Volyntsev [Tue, 19 Jun 2018 11:04:59 +0000 (14:04 +0300)]
Version 0.2.2.
Dmitry Volyntsev [Wed, 13 Jun 2018 16:38:47 +0000 (19:38 +0300)]
Fixed heap-buffer-overflow in crypto.createHmac().
Dmitry Volyntsev [Wed, 13 Jun 2018 11:15:43 +0000 (14:15 +0300)]
http internalRedirect() method.
Performs internal redirect to the specified uri.
req.internalRedirect(<uri>):
uri - string. If uri starts with '@' it is considered as a
named location.
Dmitry Volyntsev [Wed, 13 Jun 2018 11:11:58 +0000 (14:11 +0300)]
Merged HTTP Response and Reply into Request.
Splitting HTTP functionality into 3 objects Request, Response and Reply
introduced a lot of confusion as to which method should belong to which object.
New members of Request:
- req.status (res.status)
- req.parent (reply.parent)
- req.requestBody (req.body)
- req.responseBody (reply.body)
- req.headersIn (req.headers)
- req.headersOut (res.headers)
- req.sendHeader() (res.sendHeader())
- req.send() (res.send())
- req.finish() (res.finish())
- req.return() (res.return())
Deprecated members of Request:
- req.body (use req.requestBody or req.responseBody)
- req.headers (use req.headersIn or req.headersOut)
- req.response
Response is remained in place for backward compatibility and will be removed in
the following releases. Reply is replaced with Request in the req.subrequest()
callback. The deprecated properties will be removed in the following releases.
Dmitry Volyntsev [Tue, 5 Jun 2018 12:21:20 +0000 (15:21 +0300)]
Using njs_vm_error() where appropriate.
Dmitry Volyntsev [Thu, 31 May 2018 15:55:35 +0000 (18:55 +0300)]
Version bump.
Dmitry Volyntsev [Thu, 31 May 2018 15:52:45 +0000 (18:52 +0300)]
Added tag 0.2.1 for changeset
2a0a59728b5f
Dmitry Volyntsev [Thu, 31 May 2018 15:52:02 +0000 (18:52 +0300)]
Version 0.2.1.
Dmitry Volyntsev [Thu, 31 May 2018 13:34:36 +0000 (16:34 +0300)]
Renaming remnants of "nJScript" and "njscript" to "njs".
Dmitry Volyntsev [Wed, 30 May 2018 14:17:13 +0000 (17:17 +0300)]
Fixed the format specifier for ctx->status in debug log.
Dmitry Volyntsev [Wed, 30 May 2018 12:07:31 +0000 (15:07 +0300)]
Added the debug for the returned status code in js_content.
Dmitry Volyntsev [Wed, 30 May 2018 12:07:04 +0000 (15:07 +0300)]
Setting status code to 500 by default in js_content handler.
This helps to debug incorrectly written content handlers.
Dmitry Volyntsev [Mon, 28 May 2018 14:05:17 +0000 (17:05 +0300)]
Improved logging for js_set and js_content directives.
Previously, unknown functions were reported under the debug log level
which made the debugging of misconfigured directives harder.
Dmitry Volyntsev [Mon, 28 May 2018 14:05:16 +0000 (17:05 +0300)]
Fixed error logging in js_include.
Previously, ngx_log_error() was used instead of ngx_conf_log_error()
in js_include directive handler. Replacing it with ngx_conf_log_error()
to report the additional information about the location of the directive
in the configuration file.
Sergey Kandaurov [Thu, 24 May 2018 17:32:09 +0000 (20:32 +0300)]
Using getrandom() libc interface.
Available since Glibc 2.25, and FreeBSD 12.0.