]> git.kaiwu.me - njs.git/log
njs.git
8 years agoUsage of njs_opaque_value_t is refactored in public API.
Dmitry Volyntsev [Fri, 4 May 2018 16:53:19 +0000 (19:53 +0300)]
Usage of njs_opaque_value_t is refactored in public API.

8 years agoFixed crypto.createHmac() for keys with size >= alg size and < 64.
Dmitry Volyntsev [Fri, 4 May 2018 16:25:15 +0000 (19:25 +0300)]
Fixed crypto.createHmac() for keys with size >= alg size and < 64.

8 years agoPublic header cleanup.
Dmitry Volyntsev [Thu, 3 May 2018 15:29:28 +0000 (18:29 +0300)]
Public header cleanup.

8 years agoRenamed njscript to njs.
Dmitry Volyntsev [Thu, 3 May 2018 15:29:26 +0000 (18:29 +0300)]
Renamed njscript to njs.

njscript.c -> njs.c
njscript.h -> njs.h
njs.c -> njs_shell.c

8 years agoAdded njs_core.h
Dmitry Volyntsev [Fri, 27 Apr 2018 11:21:39 +0000 (14:21 +0300)]
Added njs_core.h

8 years agoFixed incorrect pointer check in njs_json_parse_string().
Dmitry Volyntsev [Fri, 27 Apr 2018 11:19:45 +0000 (14:19 +0300)]
Fixed incorrect pointer check in njs_json_parse_string().

Found by Coverity (CID 14351611435162).
The bug appeared in 29eee021e03e.

8 years agoFixed njs_vm_external_bind().
Dmitry Volyntsev [Thu, 26 Apr 2018 17:22:04 +0000 (20:22 +0300)]
Fixed njs_vm_external_bind().

Previously, it could result in misaligned values being returned.

8 years agoFixed return value type of clearTimeout().
Dmitry Volyntsev [Thu, 26 Apr 2018 17:21:46 +0000 (20:21 +0300)]
Fixed return value type of clearTimeout().

Previously, the function may return the "undefined" string.

8 years agoFixed unit tests exit code.
Dmitry Volyntsev [Thu, 26 Apr 2018 17:21:44 +0000 (20:21 +0300)]
Fixed unit tests exit code.

Previously, 0 was returned regardless of failures.

8 years agoFixed the writeable flag of Array.length property.
Dmitry Volyntsev [Thu, 26 Apr 2018 16:58:26 +0000 (19:58 +0300)]
Fixed the writeable flag of Array.length property.

This fixes #6 issue on GitHub.

8 years agoFixed handling of props in Object.getOwnPropertyDescriptor().
Dmitry Volyntsev [Thu, 26 Apr 2018 16:53:16 +0000 (19:53 +0300)]
Fixed handling of props in Object.getOwnPropertyDescriptor().

njs_property_query() is moved to njs_object.c without changes.

8 years agoFixed handling of missing arg of Object.getOwnPropertyDescriptor().
Dmitry Volyntsev [Thu, 26 Apr 2018 16:24:55 +0000 (19:24 +0300)]
Fixed handling of missing arg of Object.getOwnPropertyDescriptor().

This fixes #5 issue on GitHub.

8 years agoImproved variable names in Object.isPrototypeOf().
Dmitry Volyntsev [Thu, 26 Apr 2018 16:20:04 +0000 (19:20 +0300)]
Improved variable names in Object.isPrototypeOf().

8 years agoFixed return value type for boolean functions.
Dmitry Volyntsev [Thu, 26 Apr 2018 16:11:29 +0000 (19:11 +0300)]
Fixed return value type for boolean functions.

Previously, the functions returned "true" and "false" strings.

8 years agoFixed handling of undefined arguments of functions.
Dmitry Volyntsev [Thu, 26 Apr 2018 16:11:28 +0000 (19:11 +0300)]
Fixed handling of undefined arguments of functions.

This fixes #7 issue on GitHub.

8 years agoAdding const qualifiers to njs_number_dec_parse() and friends.
Dmitry Volyntsev [Thu, 26 Apr 2018 16:11:28 +0000 (19:11 +0300)]
Adding const qualifiers to njs_number_dec_parse() and friends.

The functions which call njs_number_dec_parse() and friends are
changed accordingly.

8 years agoAdded array length setter.
Dmitry Volyntsev [Fri, 20 Apr 2018 13:42:12 +0000 (16:42 +0300)]
Added array length setter.

This fixes #1 issue on GitHub.

8 years agoMaking native getters into universal property handlers.
Dmitry Volyntsev [Fri, 20 Apr 2018 13:42:10 +0000 (16:42 +0300)]
Making native getters into universal property handlers.

8 years agoFixed exception type for unsupported types in JSON.stringify().
Dmitry Volyntsev [Fri, 20 Apr 2018 13:42:10 +0000 (16:42 +0300)]
Fixed exception type for unsupported types in JSON.stringify().

8 years agoFixed JSON.stringify() for arrays with empty cells.
Dmitry Volyntsev [Fri, 20 Apr 2018 13:42:08 +0000 (16:42 +0300)]
Fixed JSON.stringify() for arrays with empty cells.

8 years agoREADME: added github as a way to report issues and send patches.
Dmitry Volyntsev [Wed, 11 Apr 2018 14:31:53 +0000 (17:31 +0300)]
README: added github as a way to report issues and send patches.

8 years agoHTTP request body getter.
Dmitry Volyntsev [Mon, 9 Apr 2018 18:02:11 +0000 (21:02 +0300)]
HTTP request body getter.

Returns the client request body.

8 years agoAdded shortcuts for creating errors from the outside of a VM.
Dmitry Volyntsev [Mon, 9 Apr 2018 18:02:10 +0000 (21:02 +0300)]
Added shortcuts for creating errors from the outside of a VM.

njs_vm_error(), njs_vm_memory_error().

8 years agoFixed crypto update() method after digest() is called.
Dmitry Volyntsev [Thu, 5 Apr 2018 16:06:35 +0000 (19:06 +0300)]
Fixed crypto update() method after digest() is called.

8 years agoChecking the number argument of HTTP return() method is valid.
Dmitry Volyntsev [Thu, 5 Apr 2018 11:50:45 +0000 (14:50 +0300)]
Checking the number argument of HTTP return() method is valid.

8 years agoAdded njs_value_is_valid_number().
Dmitry Volyntsev [Thu, 5 Apr 2018 11:50:45 +0000 (14:50 +0300)]
Added njs_value_is_valid_number().

8 years agoUsing correct code size addition.
Igor Sysoev [Wed, 4 Apr 2018 13:21:09 +0000 (16:21 +0300)]
Using correct code size addition.

Found by Clang Static Analyzer.

8 years agoFixed surname spelling.
Dmitry Volyntsev [Tue, 3 Apr 2018 16:47:57 +0000 (19:47 +0300)]
Fixed surname spelling.

8 years agoExact values for default switch case expressions.
Igor Sysoev [Tue, 3 Apr 2018 14:55:56 +0000 (17:55 +0300)]
Exact values for default switch case expressions.

8 years agoStyle fixes.
Igor Sysoev [Tue, 3 Apr 2018 14:55:23 +0000 (17:55 +0300)]
Style fixes.

8 years agoSmall optimizations.
Igor Sysoev [Tue, 3 Apr 2018 14:55:08 +0000 (17:55 +0300)]
Small optimizations.

8 years agoThe typeof operation did not work in functions.
Igor Sysoev [Tue, 3 Apr 2018 14:55:04 +0000 (17:55 +0300)]
The typeof operation did not work in functions.

8 years ago2018 year.
Dmitry Volyntsev [Tue, 3 Apr 2018 11:51:22 +0000 (14:51 +0300)]
2018 year.

8 years agoVersion bump.
Dmitry Volyntsev [Tue, 3 Apr 2018 11:01:06 +0000 (14:01 +0300)]
Version bump.

8 years agoAdded tag 0.2.0 for changeset ddd1b2c9c64b
Dmitry Volyntsev [Tue, 3 Apr 2018 10:58:34 +0000 (13:58 +0300)]
Added tag 0.2.0 for changeset ddd1b2c9c64b

8 years agoVersion 0.2.0. 0.2.0
Dmitry Volyntsev [Tue, 3 Apr 2018 10:57:42 +0000 (13:57 +0300)]
Version 0.2.0.

8 years agoAdded global njs object.
Dmitry Volyntsev [Tue, 3 Apr 2018 10:56:54 +0000 (13:56 +0300)]
Added global njs object.

8 years agoHTTP response return() method.
Roman Arutyunyan [Mon, 2 Apr 2018 15:01:34 +0000 (18:01 +0300)]
HTTP response return() method.

The method is a shortcut for finalizing an HTTP request and is similar to nginx
return directive.

res.return(code[, text]):
    code - numeric status code.
    text - response body or redirect URI (for 3xx responses).

8 years agoAdded base64url encoding for crypto hash and HMAC digests.
Dmitry Volyntsev [Mon, 2 Apr 2018 14:12:52 +0000 (17:12 +0300)]
Added base64url encoding for crypto hash and HMAC digests.

8 years agoFixed the version of njs.
Dmitry Volyntsev [Mon, 2 Apr 2018 11:12:00 +0000 (14:12 +0300)]
Fixed the version of njs.

The version in the code should be above the latest tag version.

8 years agoRemoved excessive debug log for HTTP req.send().
Dmitry Volyntsev [Fri, 30 Mar 2018 17:11:10 +0000 (20:11 +0300)]
Removed excessive debug log for HTTP req.send().

8 years agoNodejs style crypto methods.
Dmitry Volyntsev [Fri, 30 Mar 2018 15:50:38 +0000 (18:50 +0300)]
Nodejs style crypto methods.

var crypto = require('crypto')
var hash = crypto.createHash(<alg>)
    available algorithms: 'md5', 'sha1', 'sha256'.
hash.update(<data>)
hash.digest([<encoding>])
    available encodings: 'hex', 'base64'.

var hmac = crypto.createHmac(<alg>, <key>)
    available algorithms: 'md5', 'sha1', 'sha256'.
hmac.update(<data>)
hmac.digest([<encoding>])
    available encodings: 'hex', 'base64'.

8 years agoRenamed njs_value_is_true into njs_value_is_boolean.
Dmitry Volyntsev [Fri, 30 Mar 2018 12:46:40 +0000 (15:46 +0300)]
Renamed njs_value_is_true into njs_value_is_boolean.

8 years agoByte string to hex, base64, base64url encodings.
Dmitry Volyntsev [Fri, 30 Mar 2018 12:46:39 +0000 (15:46 +0300)]
Byte string to hex, base64, base64url encodings.

8 years agoAdded base64 encoding for byte strings.
Dmitry Volyntsev [Fri, 30 Mar 2018 12:46:38 +0000 (15:46 +0300)]
Added base64 encoding for byte strings.

8 years agoAdded hex encoding for byte strings.
Dmitry Volyntsev [Fri, 30 Mar 2018 12:46:38 +0000 (15:46 +0300)]
Added hex encoding for byte strings.

8 years agoAdded additional log routines for different nginx log levels.
Dmitry Volyntsev [Thu, 29 Mar 2018 13:38:02 +0000 (16:38 +0300)]
Added additional log routines for different nginx log levels.

warn(), error().

8 years agoShort exception macros' names.
Dmitry Volyntsev [Tue, 27 Mar 2018 16:11:04 +0000 (19:11 +0300)]
Short exception macros' names.

8 years agoFixed njs_object_hash_create() for 0 elements.
Dmitry Volyntsev [Fri, 23 Mar 2018 11:03:09 +0000 (14:03 +0300)]
Fixed njs_object_hash_create() for 0 elements.

8 years agoFixed external_objects cloning.
Dmitry Volyntsev [Fri, 23 Mar 2018 11:02:22 +0000 (14:02 +0300)]
Fixed external_objects cloning.

8 years agoFixed copying of a garbage value.
Dmitry Volyntsev [Fri, 23 Mar 2018 10:53:27 +0000 (13:53 +0300)]
Fixed copying of a garbage value.

Found by Clang Static Analyzer.

Additionally, unnecessary body_arg.length zeroing is removed.

8 years agoFixed njs_vm_t struct alignment on 32bits platforms.
Dmitry Volyntsev [Thu, 22 Mar 2018 12:05:08 +0000 (15:05 +0300)]
Fixed njs_vm_t struct alignment on 32bits platforms.

8 years agoFixed function frame alignment on 32bits platforms.
Dmitry Volyntsev [Thu, 22 Mar 2018 12:05:06 +0000 (15:05 +0300)]
Fixed function frame alignment on 32bits platforms.

8 years agohttp subrequest() method.
Dmitry Volyntsev [Wed, 21 Mar 2018 14:33:13 +0000 (17:33 +0300)]
http subrequest() method.

Creates an nginx's subrequest with the specified arguments and
registers a finalization callback.

req.subrequest(<uri>[, <options>[, <callback>]]):
    uri - string.
    options - string | object.
        string value - uri arguments.
        object value can contain:
            args, body, method all are string values.
    callback - function with the following argument:
        reply - the result object with the following properties:
            uri, method, status, contentType, contentLength,
            headers, args, body, parent.

8 years agohttp req.response() method.
Dmitry Volyntsev [Wed, 21 Mar 2018 14:33:12 +0000 (17:33 +0300)]
http req.response() method.

8 years agosetTimeout() and clearTimeout() methods.
Dmitry Volyntsev [Wed, 21 Mar 2018 14:33:12 +0000 (17:33 +0300)]
setTimeout() and clearTimeout() methods.

Public methods are introduced to create and post async events for
a VM instance.  njs_vm_add_event() creates an async event for the VM
to wait for.  njs_vm_post_event() notifies the VM that the event
occurred.  If async events were added njs_vm_run() returns NJS_AGAIN
until there are no remaining pending events.

8 years agoImproved the exception handling in njs_vmcode_method_frame().
Dmitry Volyntsev [Thu, 15 Mar 2018 12:15:25 +0000 (15:15 +0300)]
Improved the exception handling in njs_vmcode_method_frame().

8 years agoMaking njs_exception_error_create() thread-safe.
Dmitry Volyntsev [Thu, 15 Mar 2018 12:15:24 +0000 (15:15 +0300)]
Making njs_exception_error_create() thread-safe.

8 years agoFixed a dead store.
Dmitry Volyntsev [Thu, 15 Mar 2018 12:15:24 +0000 (15:15 +0300)]
Fixed a dead store.

Found by Clang Static Analyzer.

8 years agoFixed RegExp trace handlers.
Dmitry Volyntsev [Thu, 15 Mar 2018 12:15:23 +0000 (15:15 +0300)]
Fixed RegExp trace handlers.

Found by Clang Static Analyzer.

8 years agoCode simplification.
Igor Sysoev [Wed, 14 Mar 2018 11:32:24 +0000 (14:32 +0300)]
Code simplification.

A dead assignment left after the changeset 6738ff52a2cb was found
by Clang Static Analyzer.

8 years agoFixed 1 byte heap buffer overflow.
Dmitry Volyntsev [Tue, 13 Mar 2018 17:37:01 +0000 (20:37 +0300)]
Fixed 1 byte heap buffer overflow.

8 years agoRemoved unused null proto hash.
Igor Sysoev [Tue, 13 Mar 2018 16:51:25 +0000 (19:51 +0300)]
Removed unused null proto hash.

8 years agoHandling the NJS_NATIVE_GETTER properties in a single place.
Dmitry Volyntsev [Tue, 13 Mar 2018 15:55:24 +0000 (18:55 +0300)]
Handling the NJS_NATIVE_GETTER properties in a single place.

8 years agoSkip empty buffers in HTTP response send().
Roman Arutyunyan [Wed, 28 Feb 2018 16:16:25 +0000 (19:16 +0300)]
Skip empty buffers in HTTP response send().

Such buffers lead to send errors and should never be sent.

8 years agoFixed String.prototype.toUTF8() function.
Igor Sysoev [Wed, 28 Feb 2018 13:20:11 +0000 (16:20 +0300)]
Fixed String.prototype.toUTF8() function.

A byte string returned by String.prototype.toUTF8() had length equal
to its size so the string can be processed later as an ASCII string.

8 years agoFixed the unit test's output format for a failed test.
Dmitry Volyntsev [Tue, 27 Feb 2018 11:11:00 +0000 (14:11 +0300)]
Fixed the unit test's output format for a failed test.

8 years agoFixed memory leak in CLI.
Dmitry Volyntsev [Tue, 27 Feb 2018 11:10:36 +0000 (14:10 +0300)]
Fixed memory leak in CLI.

8 years agoFixed the names of global functions in backtraces.
Dmitry Volyntsev [Tue, 20 Feb 2018 16:12:55 +0000 (19:12 +0300)]
Fixed the names of global functions in backtraces.

Previously, they were reported as 'native (native)'.

8 years agoHiding the unit tests' output under the verbose mode.
Dmitry Volyntsev [Tue, 20 Feb 2018 16:12:53 +0000 (19:12 +0300)]
Hiding the unit tests' output under the verbose mode.

8 years agoExternals refactored.
Dmitry Volyntsev [Tue, 20 Feb 2018 16:12:53 +0000 (19:12 +0300)]
Externals refactored.

Public API is rectified to allow the creation of external objects in
runtime.
    1) njs_vm_external_add() is replaced with njs_vm_external_prototype().
    The later functions returns a pointer to a prototype object which can
    be used to create a value with such a prototype in runtime.

    2) njs_vm_external() is split into njs_vm_external_create() and
    njs_vm_external_bind(). The former creates a variable with a specified
    prototype and associates it with an external pointer. The latter binds
    a variable to a name in the global namespace.

8 years agoMoving long_string fields of njs_value_t into a separate struct.
Dmitry Volyntsev [Tue, 20 Feb 2018 16:12:52 +0000 (19:12 +0300)]
Moving long_string fields of njs_value_t into a separate struct.

8 years agoFixed PATH shell variable for expect tests.
Dmitry Volyntsev [Mon, 12 Feb 2018 12:15:53 +0000 (15:15 +0300)]
Fixed PATH shell variable for expect tests.

To avoid interference with the already installed njs binary.

8 years agoFixed console.help() method return value.
Dmitry Volyntsev [Mon, 12 Feb 2018 12:15:53 +0000 (15:15 +0300)]
Fixed console.help() method return value.

8 years agoFixed njs_string_create() prototype to reflect underlying types.
Dmitry Volyntsev [Mon, 12 Feb 2018 12:15:52 +0000 (15:15 +0300)]
Fixed njs_string_create() prototype to reflect underlying types.

8 years agoFixed using of internal NJS headers in nginx modules.
Dmitry Volyntsev [Mon, 12 Feb 2018 11:57:24 +0000 (14:57 +0300)]
Fixed using of internal NJS headers in nginx modules.

Public API is rectified to make it easier to work with the private
structure njs_value_t from the outside:
    1) njs_vm_retval() is split into njs_vm_retval() which now returns
    the njs_value_t * as a return value and njs_vm_value_to_ext_string()
    which stringifies an njs_value_t * passed as an argument.

    2) njs_value_*_set() methods are added.
    3) Similar public methods are grouped together.

8 years agoAdding textual description for type converting exceptions.
Dmitry Volyntsev [Mon, 12 Feb 2018 11:54:24 +0000 (14:54 +0300)]
Adding textual description for type converting exceptions.

8 years agoFixed building by SunC.
Dmitry Volyntsev [Mon, 12 Feb 2018 11:54:23 +0000 (14:54 +0300)]
Fixed building by SunC.

8 years agoFixed expect tests for systems where echo -e is not available.
Dmitry Volyntsev [Fri, 9 Feb 2018 17:34:44 +0000 (20:34 +0300)]
Fixed expect tests for systems where echo -e is not available.

8 years agoFixed Object's methods for the undefined value.
Dmitry Volyntsev [Fri, 9 Feb 2018 17:12:41 +0000 (20:12 +0300)]
Fixed Object's methods for the undefined value.

8 years agoFixed the calculation of the scope indices for variables.
Dmitry Volyntsev [Fri, 9 Feb 2018 17:11:17 +0000 (20:11 +0300)]
Fixed the calculation of the scope indices for variables.

8 years agoInteractive shell: fixed non-ascii character support.
Dmitry Volyntsev [Fri, 9 Feb 2018 16:16:19 +0000 (19:16 +0300)]
Interactive shell: fixed non-ascii character support.

8 years agoReporting njs version by CLI.
Dmitry Volyntsev [Fri, 9 Feb 2018 16:16:18 +0000 (19:16 +0300)]
Reporting njs version by CLI.

8 years agoUsing hg archive to make dist.
Dmitry Volyntsev [Fri, 9 Feb 2018 16:16:18 +0000 (19:16 +0300)]
Using hg archive to make dist.

8 years agoFixed unit tests for NetBSD 7.
Dmitry Volyntsev [Wed, 22 Nov 2017 17:38:10 +0000 (20:38 +0300)]
Fixed unit tests for NetBSD 7.

8 years agoFixed building by GCC with -O3.
Dmitry Volyntsev [Wed, 22 Nov 2017 15:55:57 +0000 (18:55 +0300)]
Fixed building by GCC with -O3.

8 years agoAdded tag 0.1.15 for changeset 215ca47b9167
Dmitry Volyntsev [Mon, 20 Nov 2017 17:08:56 +0000 (20:08 +0300)]
Added tag 0.1.15 for changeset 215ca47b9167

8 years agoVersion 0.1.15. 0.1.15
Dmitry Volyntsev [Mon, 20 Nov 2017 17:07:15 +0000 (20:07 +0300)]
Version 0.1.15.

8 years agoMemoryError reimplemented without its own prototype.
Dmitry Volyntsev [Mon, 20 Nov 2017 16:24:58 +0000 (19:24 +0300)]
MemoryError reimplemented without its own prototype.

MemoryError is a special preallocated immutable object.  Its value type
is NJS_OBJECT_INTERNAL_ERROR. Initially the object had its own prototype
object.  It introduced inconsistency between value types and prototype
types, because some routines (for example, njs_object_prototype_to_string())
expect them to be pairwise aligned.

8 years agoFixing Coverity warnings related to close().
Dmitry Volyntsev [Mon, 20 Nov 2017 16:24:56 +0000 (19:24 +0300)]
Fixing Coverity warnings related to close().

Coverity assumes that open() can normally return 0.

8 years agoFixed a typo in njs interactive test.
Dmitry Volyntsev [Mon, 20 Nov 2017 16:24:56 +0000 (19:24 +0300)]
Fixed a typo in njs interactive test.

8 years agoFixed expect file tests.
Dmitry Volyntsev [Mon, 20 Nov 2017 16:24:55 +0000 (19:24 +0300)]
Fixed expect file tests.

Using current directory for temporary files because /tmp
is not available for writing in BB environment.

8 years agoNodejs style file methods.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Nodejs style file methods.

8 years agoAdded support of oct literals.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Added support of oct literals.

8 years agoEnabling exception backtraces in nginx modules.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Enabling exception backtraces in nginx modules.

8 years agoFixed inheriting debug metadata while cloning a VM.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Fixed inheriting debug metadata while cloning a VM.

8 years agoFixed exception handling.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Fixed exception handling.

njs_vm_exception() is removed and combined with njs_vm_retval().
vm->exception is removed either, exceptions are now stored in
vm->retval.  It simplifies the client logic, because previously
njs_vm_exception() had to be called if njs_vm_retval() fails.
Additonally, stack traces are now appended to the retval if an exception
happens.

8 years agoChecking that backtrace is available before accessing it.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Checking that backtrace is available before accessing it.

8 years agoError builtin objects.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Error builtin objects.

8 years agoFixed JSON.stringify() for objects inherited from Object prototype.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Fixed JSON.stringify() for objects inherited from Object prototype.