Re: Git Plugin

2019-11-05 Thread Ralph Seichter
* noloader:

> I'd like to put a web front-end on the Git project for browsing and
> diff'ing.

Git comes with its own web interface called "gitweb" which covers most
basic needs (see https://git-scm.com/docs/gitweb).

-Ralph
___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


[njs] Added arguments validation for configure script.

2019-11-05 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/4d33ea223de0
branches:  
changeset: 1224:4d33ea223de0
user:  Dmitry Volyntsev 
date:  Tue Nov 05 20:49:57 2019 +0300
description:
Added arguments validation for configure script.

diffstat:

 auto/help|  15 +++
 auto/make|   9 +
 auto/options |  41 +
 auto/summary |  25 +
 configure|   5 +++--
 5 files changed, 89 insertions(+), 6 deletions(-)

diffs (152 lines):

diff -r 44e41970a160 -r 4d33ea223de0 auto/help
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/auto/help Tue Nov 05 20:49:57 2019 +0300
@@ -0,0 +1,15 @@
+
+# Copyright (C) Igor Sysoev
+# Copyright (C) NGINX, Inc.
+
+
+cat << END
+
+./configure options:
+
+  --cc=FILEset C compiler filename, default: "$CC"
+  --cc-opt=OPTIONS set additional C compiler options
+  --ld-opt=OPTIONS set additional linker options
+  --ar=FILEset static linking program, default: "$AR"
+
+END
diff -r 44e41970a160 -r 4d33ea223de0 auto/make
--- a/auto/make Tue Nov 05 20:49:56 2019 +0300
+++ b/auto/make Tue Nov 05 20:49:57 2019 +0300
@@ -15,8 +15,9 @@ cat << END > $NJS_MAKEFILE
 # This file is auto-generated by configure
 
 NJS_CC = ${CC}
-NJS_AR = ${AR}
-NJS_CFLAGS = ${NJS_CFLAGS} ${CFLAGS}
+NJS_STATIC_LINK = ${AR} -r -c
+NJS_LINK = ${CC} ${NJS_LD_OPT}
+NJS_CFLAGS = ${NJS_CFLAGS} ${NJS_CC_OPT} ${CFLAGS}
 
 default: $NJS_DEFAULT_TARGET
 END
@@ -58,7 +59,7 @@ libnjs: $NJS_BUILD_DIR/libnjs.a
$NJS_BUILD_DIR/njs_auto_config.h \\
\$(NJS_LIB_OBJS)
 
-   \$(NJS_AR) -r -c $NJS_BUILD_DIR/libnjs.a \\
+   \$(NJS_STATIC_LINK) $NJS_BUILD_DIR/libnjs.a \\
\$(NJS_LIB_OBJS)
 
 END
@@ -98,7 +99,7 @@ cat << END >> $NJS_MAKEFILE
 $NJS_BUILD_DIR/njs: \\
$NJS_BUILD_DIR/libnjs.a \\
src/njs_shell.c
-   \$(NJS_CC) -o $NJS_BUILD_DIR/njs \$(NJS_CFLAGS) \\
+   \$(NJS_LINK) -o $NJS_BUILD_DIR/njs \$(NJS_CFLAGS) \\
$NJS_LIB_AUX_CFLAGS \$(NJS_LIB_INCS) -Injs \\
src/njs_shell.c \\
$NJS_BUILD_DIR/libnjs.a \\
diff -r 44e41970a160 -r 4d33ea223de0 auto/options
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/auto/options  Tue Nov 05 20:49:57 2019 +0300
@@ -0,0 +1,41 @@
+
+# Copyright (C) Igor Sysoev
+# Copyright (C) NGINX, Inc.
+
+
+NJS_CONFIGURE_OPTIONS=
+NJS_CC_OPT=${NJS_CC_OPT:--O}
+NJS_LD_OPT=${NJS_CC_OPT:--O}
+
+for njs_option
+do
+case "$njs_option" in
+-*=*) value=`echo "$njs_option" | sed -e 's/[-_a-zA-Z0-9]*=//'`  ;;
+   *) value="" ;;
+esac
+
+case "$njs_option" in
+--cc=*)  CC="$value" ;;
+--cc-opt=*)  NJS_CC_OPT="$value" ;;
+--ld-opt=*)  NJS_LD_OPT="$value" ;;
+--ar=*)  AR="$value" ;;
+
+--help)
+. auto/help
+exit 0
+;;
+
+*)
+echo
+echo $0: error: invalid option \"$njs_option\".
+echo Run \"$0 --help\" to see available options.
+echo
+exit 1
+;;
+esac
+
+njs_opt=`echo $njs_option | sed -e "s/\(--[^=]*=\)\(.* .*\)/\1'\2'/"`
+
+NJS_CONFIGURE_OPTIONS="$NJS_CONFIGURE_OPTIONS $njs_opt"
+
+done
diff -r 44e41970a160 -r 4d33ea223de0 auto/summary
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/auto/summary  Tue Nov 05 20:49:57 2019 +0300
@@ -0,0 +1,25 @@
+
+# Copyright (C) Igor Sysoev
+# Copyright (C) NGINX, Inc.
+
+
+echo
+echo "NJS configuration summary:"
+echo
+echo " + using CC: \"$CC\""
+echo " + using CFLAGS: \"$NJS_CFLAGS $NJS_CC_OPT $CFLAGS\""
+echo
+echo " + using PCRE library: $NJS_PCRE_LIB"
+
+if [ $NJS_HAVE_READLINE = YES ]; then
+  echo " + using readline library: $NJS_READLINE_LIB"
+fi
+
+echo
+echo " njs build dir: $NJS_BUILD_DIR"
+
+if [ $NJS_HAVE_READLINE = YES ]; then
+  echo " njs CLI: $NJS_BUILD_DIR/njs"
+fi
+
+echo
diff -r 44e41970a160 -r 4d33ea223de0 configure
--- a/configure Tue Nov 05 20:49:56 2019 +0300
+++ b/configure Tue Nov 05 20:49:57 2019 +0300
@@ -24,8 +24,6 @@ NJS_TEST_LIBS=${NJS_TEST_LIBS=}
 CC=${CC:-cc}
 AR=${AR:-ar}
 NJS_CFLAGS=${NJS_CFLAGS=}
-NJS_CC_OPT=${NJS_CC_OPT:--O}
-NJS_LD_OPT=${NJS_CC_OPT:--O}
 
 NJS_BUILD_DIR=${NJS_BUILD_DIR:-build}
 
@@ -47,6 +45,7 @@ END
 NJS_LIBRT=
 
 . auto/os
+. auto/options
 . auto/cc
 . auto/clang
 . auto/time
@@ -65,3 +64,5 @@ NJS_LIB_AUX_LIBS="$NJS_PCRE_LIB"
 . auto/make
 
 . auto/expect
+
+. auto/summary
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] auto/cc cleanup.

2019-11-05 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/bb0bac71da3f
branches:  
changeset: 1222:bb0bac71da3f
user:  Dmitry Volyntsev 
date:  Tue Nov 05 20:49:56 2019 +0300
description:
auto/cc cleanup.

diffstat:

 auto/cc |  6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diffs (13 lines):

diff -r ea588c413548 -r bb0bac71da3f auto/cc
--- a/auto/cc   Tue Nov 05 20:24:48 2019 +0300
+++ b/auto/cc   Tue Nov 05 20:49:56 2019 +0300
@@ -156,9 +156,3 @@ esac
 
 # Stop on error exit status again.
 set -e
-
-cat << END >> $NJS_MAKEFILE
-
-NJS_CC =   ${CC}
-NJS_CFLAGS =   ${NJS_CFLAGS} ${CFLAGS}
-END
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Added explanation for why njs CLI cannot be built.

2019-11-05 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/44e41970a160
branches:  
changeset: 1223:44e41970a160
user:  Dmitry Volyntsev 
date:  Tue Nov 05 20:49:56 2019 +0300
description:
Added explanation for why njs CLI cannot be built.

diffstat:

 auto/make |  15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diffs (32 lines):

diff -r bb0bac71da3f -r 44e41970a160 auto/make
--- a/auto/make Tue Nov 05 20:49:56 2019 +0300
+++ b/auto/make Tue Nov 05 20:49:56 2019 +0300
@@ -91,6 +91,8 @@ done
 
 # njs cli.
 
+if [ $NJS_HAVE_READLINE = YES ]; then
+
 cat << END >> $NJS_MAKEFILE
 
 $NJS_BUILD_DIR/njs: \\
@@ -104,6 +106,19 @@ cat << END >> $NJS_MAKEFILE
 
 END
 
+else
+
+cat << END >> $NJS_MAKEFILE
+
+$NJS_BUILD_DIR/njs:
+   @echo
+   @echo " error: to make njs CLI \"readline\" library is required."
+   @echo
+   @exit 1
+
+END
+
+fi
 
 # lib tests.
 
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Added implementation of Array.prototype.copyWithin().

2019-11-05 Thread Alexander Borisov
details:   https://hg.nginx.org/njs/rev/ea588c413548
branches:  
changeset: 1221:ea588c413548
user:  Alexander Borisov 
date:  Tue Nov 05 20:24:48 2019 +0300
description:
Added implementation of Array.prototype.copyWithin().

diffstat:

 src/njs_array.c  |  122 +++
 src/test/njs_unit_test.c |   34 +
 2 files changed, 156 insertions(+), 0 deletions(-)

diffs (183 lines):

diff -r fc6aa7e27d57 -r ea588c413548 src/njs_array.c
--- a/src/njs_array.c   Sat Oct 12 16:23:25 2019 +0300
+++ b/src/njs_array.c   Tue Nov 05 20:24:48 2019 +0300
@@ -2770,6 +2770,120 @@ start:
 }
 
 
+static njs_int_t
+njs_array_prototype_copy_within(njs_vm_t *vm, njs_value_t *args,
+njs_uint_t nargs, njs_index_t unused)
+{
+int8_t   direction;
+int64_t  count, to, from, end;
+uint32_t length;
+njs_int_tret;
+njs_array_t  *array;
+njs_value_t  *this, *value, from_key, to_key, prop;
+
+this = njs_arg(args, nargs, 0);
+
+ret = njs_value_to_object(vm, this);
+if (njs_slow_path(ret != NJS_OK)) {
+return ret;
+}
+
+ret = njs_value_length(vm, this, );
+if (njs_slow_path(ret != NJS_OK)) {
+return ret;
+}
+
+ret = njs_value_to_integer(vm, njs_arg(args, nargs, 1), );
+if (njs_slow_path(ret != NJS_OK)) {
+return ret;
+}
+
+to = (to < 0) ? njs_max(length + to, 0) : njs_min(to, length);
+
+ret = njs_value_to_integer(vm, njs_arg(args, nargs, 2), );
+if (njs_slow_path(ret != NJS_OK)) {
+return ret;
+}
+
+from = (from < 0) ? njs_max(length + from, 0) : njs_min(from, length);
+
+value = njs_arg(args, nargs, 3);
+
+if (njs_is_undefined(value)) {
+end = length;
+
+} else {
+ret = njs_value_to_integer(vm, value, );
+if (njs_slow_path(ret != NJS_OK)) {
+return ret;
+}
+}
+
+end = (end < 0) ? njs_max(length + end, 0) : njs_min(end, length);
+
+count = njs_min(end - from, length - to);
+
+if (from < to && from + count) {
+direction = -1;
+from = from + count - 1;
+to = to + count - 1;
+
+} else {
+direction = 1;
+}
+
+njs_vm_retval_set(vm, this);
+
+if (njs_is_array(this)) {
+if (njs_slow_path(!njs_object_hash_is_empty(this))) {
+goto process_object;
+}
+
+array = njs_array(this);
+
+while (count-- > 0) {
+array->start[to] = array->start[from];
+
+from = from + direction;
+to = to + direction;
+}
+
+return NJS_OK;
+}
+
+process_object:
+
+while (count-- > 0) {
+/* FIXME: largest index is 2**53-1. */
+
+njs_uint32_to_string(_key, (uint32_t) from);
+njs_uint32_to_string(_key, (uint32_t) to);
+
+ret = njs_value_property(vm, this, _key, );
+
+if (ret == NJS_OK) {
+ret = njs_value_property_set(vm, this, _key, );
+
+} else {
+if (njs_slow_path(ret == NJS_ERROR)) {
+return ret;
+}
+
+ret = njs_value_property_delete(vm, this, _key, NULL);
+}
+
+if (njs_slow_path(ret == NJS_ERROR)) {
+return ret;
+}
+
+from = from + direction;
+to = to + direction;
+}
+
+return NJS_OK;
+}
+
+
 static const njs_object_prop_t  njs_array_prototype_properties[] =
 {
 {
@@ -2982,6 +3096,14 @@ static const njs_object_prop_t  njs_arra
 .writable = 1,
 .configurable = 1,
 },
+
+{
+.type = NJS_PROPERTY,
+.name = njs_string("copyWithin"),
+.value = njs_native_function(njs_array_prototype_copy_within, 2),
+.writable = 1,
+.configurable = 1,
+},
 };
 
 
diff -r fc6aa7e27d57 -r ea588c413548 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c  Sat Oct 12 16:23:25 2019 +0300
+++ b/src/test/njs_unit_test.c  Tue Nov 05 20:24:48 2019 +0300
@@ -4019,6 +4019,40 @@ static njs_unit_test_t  njs_test[] =
   "Object.defineProperty(a, 'length', {writable:true})"),
   njs_str("TypeError: Cannot redefine property: \"length\"") },
 
+{ njs_str("[1, 2, 3, 4, 5].copyWithin(0, 3)"),
+  njs_str("4,5,3,4,5") },
+
+{ njs_str("[1, 2, 3, 4, 5].copyWithin(0, 3, 4)"),
+  njs_str("4,2,3,4,5") },
+
+{ njs_str("[1, 2, 3, 4, 5].copyWithin(0, -2, -1)"),
+  njs_str("4,2,3,4,5") },
+
+{ njs_str("[1, 2, 3, 4, 5].copyWithin(100, 200, 500)"),
+  njs_str("1,2,3,4,5") },
+
+{ njs_str("[0, 1, , , 1].copyWithin(0, 1, 4)"),
+  njs_str("11") },
+
+{ njs_str("var o = [0, 1, , , 1].copyWithin(0, 1, 4); typeof o"),
+  njs_str("object") },
+
+{ njs_str("[].copyWithin.call({length: 5, 3: 1}, 0, 3)"),
+  njs_str("[object Object]") },
+
+{ njs_str("var o = [1, 2, 3, 4]; Object.defineProperties(o, { 5: {value: 
'abc'}});"
+  "[].copyWithin.call(o, 0, 3, 4);"),
+  

[njs] Added Object.assign().

2019-11-05 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/fc6aa7e27d57
branches:  
changeset: 1220:fc6aa7e27d57
user:  Alexander Mazyrin 
date:  Sat Oct 12 16:23:25 2019 +0300
description:
Added Object.assign().

diffstat:

 src/njs_object.c |  70 
 src/njs_value.c  |   3 +-
 src/test/njs_unit_test.c |  65 
 3 files changed, 136 insertions(+), 2 deletions(-)

diffs (176 lines):

diff -r ea70e6e7a0b8 -r fc6aa7e27d57 src/njs_object.c
--- a/src/njs_object.c  Fri Nov 01 19:26:42 2019 +0300
+++ b/src/njs_object.c  Sat Oct 12 16:23:25 2019 +0300
@@ -1637,6 +1637,67 @@ njs_object_is_extensible(njs_vm_t *vm, n
 }
 
 
+static njs_int_t
+njs_object_assign(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
+njs_index_t unused)
+{
+uint32_t  i, j, length;
+njs_int_t ret;
+njs_array_t   *names;
+njs_value_t   *key, *source, *value, setval;
+njs_object_prop_t *prop;
+njs_property_query_t  pq;
+
+value = njs_arg(args, nargs, 1);
+
+ret = njs_value_to_object(vm, value);
+if (njs_slow_path(ret != NJS_OK)) {
+return ret;
+}
+
+for (i = 2; i < nargs; i++) {
+source = [i];
+
+names = njs_value_own_enumerate(vm, source, NJS_ENUM_KEYS, 1);
+if (njs_slow_path(names == NULL)) {
+return NJS_ERROR;
+}
+
+length = names->length;
+
+for (j = 0; j < length; j++) {
+key = >start[j];
+
+njs_property_query_init(, NJS_PROPERTY_QUERY_GET, 1);
+
+ret = njs_property_query(vm, , source, key);
+if (njs_slow_path(ret != NJS_OK)) {
+return NJS_ERROR;
+}
+
+prop = pq.lhq.value;
+if (!prop->enumerable) {
+continue;
+}
+
+ret = njs_value_property(vm, source, key, );
+if (njs_slow_path(ret != NJS_OK)) {
+return NJS_ERROR;
+}
+
+ret = njs_value_property_set(vm, value, key, );
+if (njs_slow_path(ret != NJS_OK)) {
+return NJS_ERROR;
+}
+}
+}
+
+vm->retval = *value;
+
+return NJS_OK;
+}
+
+
 /*
  * The __proto__ property of booleans, numbers and strings primitives,
  * of objects created by Boolean(), Number(), and String() constructors,
@@ -1908,6 +1969,15 @@ static const njs_object_prop_t  njs_obje
 .writable = 1,
 .configurable = 1,
 },
+
+/* Object.assign(). */
+{
+.type = NJS_PROPERTY,
+.name = njs_string("assign"),
+.value = njs_native_function(njs_object_assign, 2),
+.writable = 1,
+.configurable = 1,
+},
 };
 
 
diff -r ea70e6e7a0b8 -r fc6aa7e27d57 src/njs_value.c
--- a/src/njs_value.c   Fri Nov 01 19:26:42 2019 +0300
+++ b/src/njs_value.c   Sat Oct 12 16:23:25 2019 +0300
@@ -1186,9 +1186,8 @@ njs_value_to_object(njs_vm_t *vm, njs_va
 return NJS_ERROR;
 }
 
-if (njs_is_object(value)) {
+if (njs_fast_path(njs_is_object(value))) {
 return NJS_OK;
-
 }
 
 if (njs_is_primitive(value)) {
diff -r ea70e6e7a0b8 -r fc6aa7e27d57 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c  Fri Nov 01 19:26:42 2019 +0300
+++ b/src/test/njs_unit_test.c  Sat Oct 12 16:23:25 2019 +0300
@@ -14531,6 +14531,71 @@ static njs_unit_test_t  njs_test[] =
 { njs_str("export"),
   njs_str("SyntaxError: Illegal export statement in 1") },
 
+{ njs_str("Object.assign(undefined)"),
+  njs_str("TypeError: cannot convert null or undefined to object") },
+
+{ njs_str("Object.assign(null)"),
+  njs_str("TypeError: cannot convert null or undefined to object") },
+
+{ njs_str("Object.assign({x:123}).toString()"),
+  njs_str("[object Object]") },
+
+{ njs_str("Object.assign({x:123}).x"),
+  njs_str("123") },
+
+{ njs_str("Object.assign(true)"),
+  njs_str("true") },
+
+{ njs_str("Object.assign(123)"),
+  njs_str("123") },
+
+{ njs_str("var o1 = {a:1, b:1, c:1}; var o2 = {b:2, c:2}; "
+ "var o3 = {c:3}; var obj = Object.assign({}, o1, o2, o3); "
+ "Object.values(obj);"),
+  njs_str("1,2,3") },
+
+{ njs_str("var v1 = 'abc'; var v2 = true; var v3 = 10; "
+ "var obj = Object.assign({}, v1, null, v2, undefined, v3); "
+ "Object.values(obj);"),
+  njs_str("a,b,c") },
+
+{ njs_str("Object.assign(true, {a:123})"),
+  njs_str("true") },
+
+{ njs_str("Object.assign(true, {a:123}).a"),
+  njs_str("123") },
+
+{ njs_str("var y = Object.create({s:123}); y.z = 456;"
+ "Object.assign({}, y).s;"),
+  njs_str("undefined") },
+
+{ njs_str("var obj = {s:123}; Object.defineProperty(obj,"
+ "'p1', {value:12, enumerable:false});"
+ "Object.assign({}, obj).p1"),
+  njs_str("undefined") },

Re: зачем писать FastCGI сервер?

2019-11-05 Thread greenwar
я даже больше скажу: можно ведь запросы поделить по категориям и под каждую
модуль слабать...
POST - один модуль обрабатывает
AJAX - другой
GET-reports
GET-table
GET-show
каждому свой модуль - идеально?

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?21,286092,286093#msg-286093

___
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru

зачем писать FastCGI сервер?

2019-11-05 Thread greenwar
Добрый день.
а нельзя ли обойтись БЕЗ fcgi на пути к самому производительному серверу,
м?
вот, например, "Hello World" в виде N-модуля прекрасно себя чувствует:
https://tejgop.github.io/nginx-module-guide/#the-c-file
что мешает сходить в БД, собрать string "..." и также вернуть
клиенту через NGINX?

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?21,286092,286092#msg-286092

___
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru