[njs] Uncommented a successful test of Object.create([1,2]).length.

2019-05-21 Thread Valentin Bartenev
details:   https://hg.nginx.org/njs/rev/260d9d4f29ee
branches:  
changeset: 977:260d9d4f29ee
user:  Valentin Bartenev 
date:  Tue May 21 21:15:21 2019 +0300
description:
Uncommented a successful test of Object.create([1,2]).length.

It's actually passing after f5bdddca3252.

diffstat:

 njs/test/njs_unit_test.c |  2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diffs (14 lines):

diff -r 96dc80e2ea1b -r 260d9d4f29ee njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c  Tue May 21 20:45:42 2019 +0300
+++ b/njs/test/njs_unit_test.c  Tue May 21 21:15:21 2019 +0300
@@ -3399,10 +3399,8 @@ static njs_unit_test_t  njs_test[] =
 { nxt_string("\n[\n1\n,\n2]\n[\n0]"),
   nxt_string("1") },
 
-#if 0
 { nxt_string("Object.create([1,2]).length"),
   nxt_string("2") },
-#endif
 
 { nxt_string("Object.create(['α','β'])[1]"),
   nxt_string("β") },
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

[njs] Fixed integer-overflow in String.prototype.concat().

2019-05-21 Thread Alexander Borisov
details:   https://hg.nginx.org/njs/rev/96dc80e2ea1b
branches:  
changeset: 976:96dc80e2ea1b
user:  Alexander Borisov 
date:  Tue May 21 20:45:42 2019 +0300
description:
Fixed integer-overflow in String.prototype.concat().

This closes #159 issue on GitHub.

diffstat:

 njs/njs_string.c |  11 ---
 njs/njs_string.h |   4 ++--
 njs/test/njs_unit_test.c |   5 +
 3 files changed, 15 insertions(+), 5 deletions(-)

diffs (61 lines):

diff -r 8d8fd9c98174 -r 96dc80e2ea1b njs/njs_string.c
--- a/njs/njs_string.c  Tue May 21 19:39:25 2019 +0300
+++ b/njs/njs_string.c  Tue May 21 20:45:42 2019 +0300
@@ -181,12 +181,17 @@ njs_string_new(njs_vm_t *vm, njs_value_t
 
 
 nxt_noinline u_char *
-njs_string_alloc(njs_vm_t *vm, njs_value_t *value, uint32_t size,
-uint32_t length)
+njs_string_alloc(njs_vm_t *vm, njs_value_t *value, uint64_t size,
+uint64_t length)
 {
 uint32_t  total, map_offset, *map;
 njs_string_t  *string;
 
+if (nxt_slow_path(size > NJS_STRING_MAX_LENGTH)) {
+njs_range_error(vm, "invalid string length");
+return NULL;
+}
+
 value->type = NJS_STRING;
 njs_string_truth(value, size);
 
@@ -844,7 +849,7 @@ njs_string_prototype_concat(njs_vm_t *vm
 njs_index_t unused)
 {
 u_char *p, *start;
-size_t size, length, mask;
+uint64_t   size, length, mask;
 nxt_uint_t i;
 njs_string_prop_t  string;
 
diff -r 8d8fd9c98174 -r 96dc80e2ea1b njs/njs_string.h
--- a/njs/njs_string.h  Tue May 21 19:39:25 2019 +0300
+++ b/njs/njs_string.h  Tue May 21 20:45:42 2019 +0300
@@ -145,8 +145,8 @@ njs_string_length(njs_value_t *string)
 
 njs_ret_t njs_string_set(njs_vm_t *vm, njs_value_t *value, const u_char *start,
 uint32_t size);
-u_char *njs_string_alloc(njs_vm_t *vm, njs_value_t *value, uint32_t size,
-uint32_t length);
+u_char *njs_string_alloc(njs_vm_t *vm, njs_value_t *value, uint64_t size,
+uint64_t length);
 njs_ret_t njs_string_new(njs_vm_t *vm, njs_value_t *value, const u_char *start,
 uint32_t size, uint32_t length);
 njs_ret_t njs_string_hex(njs_vm_t *vm, njs_value_t *value,
diff -r 8d8fd9c98174 -r 96dc80e2ea1b njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c  Tue May 21 19:39:25 2019 +0300
+++ b/njs/test/njs_unit_test.c  Tue May 21 20:45:42 2019 +0300
@@ -4620,6 +4620,11 @@ static njs_unit_test_t  njs_test[] =
 { nxt_string("'A'.repeat(16).toBytes() === 'A'.repeat(16)"),
   nxt_string("true") },
 
+{ nxt_string("var s = 'x'.repeat(2**10).repeat(2**14);"
+ "var a = Array(200).fill(s);"
+ "String.prototype.concat.apply(s, a.slice(1))"),
+  nxt_string("RangeError: invalid string length") },
+
 { nxt_string("var a = 'abcdefgh'; a.substr(3, 15)"),
   nxt_string("defgh") },
 
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Version bump.

2019-05-21 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/8d8fd9c98174
branches:  
changeset: 975:8d8fd9c98174
user:  Dmitry Volyntsev 
date:  Tue May 21 19:39:25 2019 +0300
description:
Version bump.

diffstat:

 njs/njs.h |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 3a5325660c89 -r 8d8fd9c98174 njs/njs.h
--- a/njs/njs.h Tue May 21 17:32:32 2019 +0300
+++ b/njs/njs.h Tue May 21 19:39:25 2019 +0300
@@ -11,7 +11,7 @@
 
 #include 
 
-#define NJS_VERSION "0.3.2"
+#define NJS_VERSION "0.3.3"
 
 
 #include 
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Version 0.3.2.

2019-05-21 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/82101d50fff6
branches:  
changeset: 973:82101d50fff6
user:  Dmitry Volyntsev 
date:  Tue May 21 17:31:13 2019 +0300
description:
Version 0.3.2.

diffstat:

 CHANGES |  68 +
 1 files changed, 68 insertions(+), 0 deletions(-)

diffs (75 lines):

diff -r 283813f5840f -r 82101d50fff6 CHANGES
--- a/CHANGES   Mon May 20 16:05:58 2019 +0800
+++ b/CHANGES   Tue May 21 17:31:13 2019 +0300
@@ -1,3 +1,71 @@
+
+Changes with njs 0.3.2   21 May 2019
+
+Core:
+
+*) Feature: added support for template literals.
+   Thanks to 洪志道 (Hong Zhi Dao) and Artem S. Povalyukhin.
+
+*) Feature: executing command from command line arguments.
+
+*) Feature: added support for RegExp "groups" object (ES9).
+
+*) Feature: added block scoped function definitions support.
+
+*) Feature: added support for building with GNU Readline library.
+
+*) Feature: made configurable "length", "name", and most of built-in
+   methods.
+
+*) Feature: made all constructor properties configurable.
+
+*) Bugfix: fixed Regexp.prototype.exec() for Unicode-only regexps.
+
+*) Bugfix: fixed njs_vm_value_dump() for empty string values.
+
+*) Bugfix: fixed RegExp constructor for regexp value arguments.
+
+*) Bugfix: fixed walking over prototypes chain during iteration
+   over an object.
+
+*) Bugfix: fixed overflow in Array.prototype.concat().
+
+*) Bugfix: fixed length calculation for UTF-8 string with escape
+   characters.
+
+*) Bugfix: fixed parsing surrogate pair presents as UTF-16 escape
+   sequences.
+
+*) Bugfix: fixed processing asterisk quantifier for
+   String.prototype.match().
+
+*) Bugfix: fixed Date() constructor with one argument.
+
+*) Bugfix: fixed arrays expansion.
+
+*) Bugfix: fixed heap-buffer-overflow in String.prototype.replace().
+
+*) Bugfix: fixed heap-buffer-overflow in
+   String.prototype.lastIndexOf().
+
+*) Bugfix: fixed regexp literals parsing with escaped backslash and
+   backslash in square brackets.
+
+*) Bugfix: fixed regexp literals with lone closing brackets.
+
+*) Bugfix: fixed uninitialized-memory-access in
+   Object.defineProperties().
+
+*) Bugfix: fixed processing "*" quantifier for
+   String.prototype.replace().
+
+*) Bugfix: fixed Array.prototype.slice() for UTF8-invalid byte
+   strings.
+
+*) Bugfix: fixed String.prototype.split() for UTF8-invalid byte
+   strings.
+
+*) Bugfix: fixed handling of empty block statements.
 
 Changes with njs 0.3.1   16 Apr 2019
 
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

[njs] Added tag 0.3.2 for changeset 82101d50fff6

2019-05-21 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/3a5325660c89
branches:  
changeset: 974:3a5325660c89
user:  Dmitry Volyntsev 
date:  Tue May 21 17:32:32 2019 +0300
description:
Added tag 0.3.2 for changeset 82101d50fff6

diffstat:

 .hgtags |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (8 lines):

diff -r 82101d50fff6 -r 3a5325660c89 .hgtags
--- a/.hgtags   Tue May 21 17:31:13 2019 +0300
+++ b/.hgtags   Tue May 21 17:32:32 2019 +0300
@@ -25,3 +25,4 @@ 4624ba4f6497a3d10fe1c0a6f45fb453579502f5
 ee190d3ace005f8eb063d4763b578f44d3028c68 0.2.8
 1935ab4643fdaec5b4a8c36070f4d2cb8e3799d7 0.3.0
 ebfbdb8d8fe2f640d880359575657cb53e38328f 0.3.1
+82101d50fff6e4c7a92c0542a3d6026ff7e462fb 0.3.2
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[nginx] release-1.17.0 tag

2019-05-21 Thread Maxim Dounin
details:   https://hg.nginx.org/nginx/rev/234373adb2ce
branches:  
changeset: 7511:234373adb2ce
user:  Maxim Dounin 
date:  Tue May 21 17:23:57 2019 +0300
description:
release-1.17.0 tag

diffstat:

 .hgtags |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (8 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -438,3 +438,4 @@ d2fd76709909767fc727a5b4affcf1dc9ca488a7
 75f5c7f628411c79c7044102049f7ab4f7a246e7 release-1.15.10
 5155d0296a5ef9841f035920527ffdb771076b44 release-1.15.11
 0130ca3d58437b3c7c707c813d530c68da9a release-1.15.12
+054c1c46395caff79bb4caf16f40b331f71bb6dd release-1.17.0
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[nginx] nginx-1.17.0-RELEASE

2019-05-21 Thread Maxim Dounin
details:   https://hg.nginx.org/nginx/rev/054c1c46395c
branches:  
changeset: 7510:054c1c46395c
user:  Maxim Dounin 
date:  Tue May 21 17:23:57 2019 +0300
description:
nginx-1.17.0-RELEASE

diffstat:

 docs/xml/nginx/changes.xml |  62 ++
 1 files changed, 62 insertions(+), 0 deletions(-)

diffs (72 lines):

diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml
--- a/docs/xml/nginx/changes.xml
+++ b/docs/xml/nginx/changes.xml
@@ -5,6 +5,68 @@
 
 
 
+
+
+
+
+директивы limit_rate и limit_rate_after поддерживают переменные.
+
+
+variables support in the "limit_rate" and "limit_rate_after" directives.
+
+
+
+
+
+директивы proxy_upload_rate и proxy_download_rate в модуле stream
+поддерживают переменные.
+
+
+variables support
+in the "proxy_upload_rate" and "proxy_download_rate" directives
+in the stream module.
+
+
+
+
+
+минимальная поддерживаемая версия OpenSSL0.9.8.
+
+
+minimum supported OpenSSL version is 0.9.8.
+
+
+
+
+
+теперь postpone-фильтр собирается всегда.
+
+
+now the postpone filter is always built.
+
+
+
+
+
+директива include не работала в блоках if и limit_except.
+
+
+the "include" directive did not work inside the "if" and "limit_except" blocks.
+
+
+
+
+
+в обработке byte ranges.
+
+
+in byte ranges processing.
+
+
+
+
+
+
 
 
 
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Module: choose upstream server based on request body

2019-05-21 Thread st4ck0v3rfl0w
 Hi,

I want to create a module, that fastcgi_passes a request to different
servers based on the content of the post request. Initially I had two ideas:

1. Create a load balancer module: I was not successful with this, because I
did not know how to access the request.

2. Create a variable that classifies the request based on the content, then
map it on server addresses and call fastcgi_pass on the map variable. This
seems easy and elegant, but the r->request_body variable is NULL for me.

What I did:
- create module without directive
- call ngx_http_add_variable in the preconfig function
- set a getter for the variable
- try to read r->request_body in the getter

I just cannot find a lot of information about this online. I probably
should call ngx_http_read_client_request_body at some point, but I am
struggling how to use it correctly.

How can I make the request_body available when reading the variable? Is
there a different and easier / more elegant way to solve this?

Thanks for your time :)
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel