]> git.kaiwu.me - njs.git/log
njs.git
7 years agoRemoved artifacts left after changeset 25bd2742a18b.
Igor Sysoev [Tue, 24 Jul 2018 16:50:02 +0000 (19:50 +0300)]
Removed artifacts left after changeset 25bd2742a18b.

7 years agoFixed configure process with non-default locale.
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.

7 years agoFixed typo in njs_arg_type_string() for NJS_DATE_ARG.
Dmitry Volyntsev [Tue, 24 Jul 2018 15:29:25 +0000 (18:29 +0300)]
Fixed typo in njs_arg_type_string() for NJS_DATE_ARG.

7 years agoRestricted usage of r.subrequest() and r.parent.
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).

7 years agoBacked out changeset 552da720e6e6.
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.

7 years agoImproved help desrcription of njs shell.
Dmitry Volyntsev [Fri, 20 Jul 2018 17:11:02 +0000 (20:11 +0300)]
Improved help desrcription of njs shell.

7 years agoSilenced Coverity false-positive warning (CID 1438046).
Dmitry Volyntsev [Fri, 20 Jul 2018 13:09:50 +0000 (16:09 +0300)]
Silenced Coverity false-positive warning (CID 1438046).

7 years agoFixed compilation by gcc 4.2.
Dmitry Volyntsev [Fri, 20 Jul 2018 12:59:59 +0000 (15:59 +0300)]
Fixed compilation by gcc 4.2.

7 years agoFixed Number.toString().
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.

7 years agoString.bytesFrom() method.
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.

7 years agoFixed exception handling in njs_vm_value_to_ext_string().
Dmitry Volyntsev [Tue, 17 Jul 2018 17:25:47 +0000 (20:25 +0300)]
Fixed exception handling in njs_vm_value_to_ext_string().

7 years agoAdded getentropy() support.
Sergey Kandaurov [Mon, 16 Jul 2018 11:30:41 +0000 (14:30 +0300)]
Added getentropy() support.

7 years agoSupplied getrandom() test with commentary about supported OSes.
Sergey Kandaurov [Mon, 16 Jul 2018 11:21:09 +0000 (14:21 +0300)]
Supplied getrandom() test with commentary about supported OSes.

7 years agoStyle.
Sergey Kandaurov [Mon, 16 Jul 2018 11:20:16 +0000 (14:20 +0300)]
Style.

7 years agoReturning MemoryError exception without any allocations.
Dmitry Volyntsev [Fri, 13 Jul 2018 12:12:11 +0000 (15:12 +0300)]
Returning MemoryError exception without any allocations.

7 years agoInteractive shell: improved error handling.
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.

7 years agoStyle fixes.
Igor Sysoev [Tue, 3 Jul 2018 12:48:04 +0000 (15:48 +0300)]
Style fixes.

7 years agoAdded information about illegal token in number parsing.
Igor Sysoev [Tue, 3 Jul 2018 12:48:03 +0000 (15:48 +0300)]
Added information about illegal token in number parsing.

7 years agoFixed Number() with boolean, null and undefined arguments.
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.

7 years agoImproved file mode in CLI.
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.

7 years agoReturning external methods as native Function objects.
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.

7 years agoAdding support for multiple arguments in console.log().
Unknown [Tue, 26 Jun 2018 11:27:33 +0000 (18:27 +0700)]
Adding support for multiple arguments in console.log().

7 years agoString.padStart() and String.padEnd() methods.
Valentin Bartenev [Fri, 29 Jun 2018 19:36:41 +0000 (22:36 +0300)]
String.padStart() and String.padEnd() methods.

7 years agoFixed autocompletion for global objects.
Dmitry Volyntsev [Mon, 2 Jul 2018 13:10:52 +0000 (16:10 +0300)]
Fixed autocompletion for global objects.

This fixes #23 issue on GitHub.

7 years agoAdded support of binary literals.
Valentin Bartenev [Sun, 1 Jul 2018 07:01:53 +0000 (10:01 +0300)]
Added support of binary literals.

7 years agoAllowed uppercased O in octal literal values.
Valentin Bartenev [Sun, 1 Jul 2018 06:59:45 +0000 (09:59 +0300)]
Allowed uppercased O in octal literal values.

7 years agoFixed error handling of setting non-numeric Array.length.
Valentin Bartenev [Sat, 30 Jun 2018 17:39:22 +0000 (20:39 +0300)]
Fixed error handling of setting non-numeric Array.length.

7 years agoAdding lib_test to generic test target.
Dmitry Volyntsev [Thu, 28 Jun 2018 14:04:18 +0000 (17:04 +0300)]
Adding lib_test to generic test target.

7 years agoFixed building unit tests after nxt_length() expansion.
Sergey Kandaurov [Thu, 28 Jun 2018 11:37:25 +0000 (14:37 +0300)]
Fixed building unit tests after nxt_length() expansion.

7 years agoIntroduced nxt_length() macro.
Valentin Bartenev [Tue, 26 Jun 2018 15:25:22 +0000 (18:25 +0300)]
Introduced nxt_length() macro.

7 years agoVersion bump.
Dmitry Volyntsev [Tue, 19 Jun 2018 11:07:22 +0000 (14:07 +0300)]
Version bump.

7 years agoAdded tag 0.2.2 for changeset 4adbb035caa3
Dmitry Volyntsev [Tue, 19 Jun 2018 11:05:18 +0000 (14:05 +0300)]
Added tag 0.2.2 for changeset 4adbb035caa3

7 years agoVersion 0.2.2. 0.2.2
Dmitry Volyntsev [Tue, 19 Jun 2018 11:04:59 +0000 (14:04 +0300)]
Version 0.2.2.

7 years agoFixed heap-buffer-overflow in crypto.createHmac().
Dmitry Volyntsev [Wed, 13 Jun 2018 16:38:47 +0000 (19:38 +0300)]
Fixed heap-buffer-overflow in crypto.createHmac().

7 years agohttp internalRedirect() method.
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.

7 years agoMerged HTTP Response and Reply into Request.
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.

7 years agoUsing njs_vm_error() where appropriate.
Dmitry Volyntsev [Tue, 5 Jun 2018 12:21:20 +0000 (15:21 +0300)]
Using njs_vm_error() where appropriate.

7 years agoVersion bump.
Dmitry Volyntsev [Thu, 31 May 2018 15:55:35 +0000 (18:55 +0300)]
Version bump.

7 years agoAdded tag 0.2.1 for changeset 2a0a59728b5f
Dmitry Volyntsev [Thu, 31 May 2018 15:52:45 +0000 (18:52 +0300)]
Added tag 0.2.1 for changeset 2a0a59728b5f

7 years agoVersion 0.2.1. 0.2.1
Dmitry Volyntsev [Thu, 31 May 2018 15:52:02 +0000 (18:52 +0300)]
Version 0.2.1.

7 years agoRenaming remnants of "nJScript" and "njscript" to "njs".
Dmitry Volyntsev [Thu, 31 May 2018 13:34:36 +0000 (16:34 +0300)]
Renaming remnants of "nJScript" and "njscript" to "njs".

7 years agoFixed the format specifier for ctx->status in debug log.
Dmitry Volyntsev [Wed, 30 May 2018 14:17:13 +0000 (17:17 +0300)]
Fixed the format specifier for ctx->status in debug log.

7 years agoAdded the debug for the returned status code in js_content.
Dmitry Volyntsev [Wed, 30 May 2018 12:07:31 +0000 (15:07 +0300)]
Added the debug for the returned status code in js_content.

7 years agoSetting status code to 500 by default in js_content handler.
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.

7 years agoImproved logging for js_set and js_content directives.
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.

7 years agoFixed error logging in js_include.
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.

7 years agoUsing getrandom() libc interface.
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.

8 years agoStyle.
Roman Arutyunyan [Mon, 14 May 2018 12:03:29 +0000 (15:03 +0300)]
Style.

8 years agoMoved njs vm to the main configuration.
Roman Arutyunyan [Tue, 17 Apr 2018 14:15:27 +0000 (17:15 +0300)]
Moved njs vm to the main configuration.

Previously, vm and proto objects were located in the location (server for
stream) configuration.  Since there's only one instance of these objects, they
are moved to the main configuration.

8 years agoRemoved the surplus arguments of exception macros.
Dmitry Volyntsev [Mon, 14 May 2018 11:10:23 +0000 (14:10 +0300)]
Removed the surplus arguments of exception macros.

8 years agoRemoved njscript.c
Dmitry Volyntsev [Mon, 7 May 2018 12:49:02 +0000 (15:49 +0300)]
Removed njscript.c

The file was not deleted during renaming in 71455987b770.

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.