Home
last modified time | relevance | path

Searched hist:38 (Results 1 – 25 of 52) sorted by last modified time

123

/unit/test/
H A Dconftest.pydiff 1769:b7cd1517081e Fri Jan 08 10:38:00 UTC 2021 Tiago Natel de Moura <t.nateldemoura@f5.com> Tests: fixed test_respawn.py to act upon test processes.

Running `test_respawn_` test cases on a machine with Unit
daemon in background would fail tests because `ps ax` was
used without filtering out other unit instances.

This patch also prevents from tests killing other Unit
processes not related to tests.
H A Dtest_php_application.pydiff 2230:83b2d20d8f5c Fri Sep 16 13:38:00 UTC 2022 Andrew Clayton <a.clayton@nginx.com> PHP: allowed to specify URLs without a trailing '/'.

Both @lucatacconi & @mwoodpatrick reported what appears to be the same
issue on GitHub. Namely that when using the PHP language module and
trying to access a URL that is a directory but without specifying the
trailing '/', they were getting a '503 Service Unavailable' error.

Note: This is when _not_ using the 'script' option.

E.g with the following config

{
"listeners": {
"[::1]:8080": {
"pass": "applications/php"
}
},

"applications": {
"php": {
"type": "php",
"root": "/var/tmp/unit-php"
}
}
}

and with a directory path of /var/tmp/unit-php/foo containing an
index.php, you would see the following

$ curl http://localhost/foo
<title>Error 503</title>
Error 503

However

$ curl http://localhost/foo/

would work and serve up the index.php

This commit fixes the above so you get the desired behaviour without
specifying the trailing '/' by doing the following

1] If the URL doesn't end in .php and doesn't have a trailing '/'
then check if the requested path is a directory.

2) If it is a directory then create a 301 re-direct pointing to it.
This matches the behaviour of the likes of nginx, Apache and
lighttpd.

This also matches the behaviour of the "share" action in Unit.

This doesn't effect the behaviour of the 'script' option which bypasses
the nxt_php_dynamic_request() function.

This also adds a couple of tests to test/test_php_application.py to
ensure this continues to work.

Closes: <https://github.com/nginx/unit/issues/717>
Closes: <https://github.com/nginx/unit/issues/753>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
diff 1017:887a4bbabf1e Tue Mar 26 20:38:00 UTC 2019 Andrey Zelenkov <zelenkov@nginx.com> Tests: style.
H A Dtest_ruby_application.pydiff 1017:887a4bbabf1e Tue Mar 26 20:38:00 UTC 2019 Andrey Zelenkov <zelenkov@nginx.com> Tests: style.
H A Dtest_settings.pydiff 1017:887a4bbabf1e Tue Mar 26 20:38:00 UTC 2019 Andrey Zelenkov <zelenkov@nginx.com> Tests: style.
H A Dtest_routing.pydiff 1017:887a4bbabf1e Tue Mar 26 20:38:00 UTC 2019 Andrey Zelenkov <zelenkov@nginx.com> Tests: style.
H A Dtest_python_application.pydiff 1017:887a4bbabf1e Tue Mar 26 20:38:00 UTC 2019 Andrey Zelenkov <zelenkov@nginx.com> Tests: style.
H A Dtest_perl_application.pydiff 1017:887a4bbabf1e Tue Mar 26 20:38:00 UTC 2019 Andrey Zelenkov <zelenkov@nginx.com> Tests: style.
H A Dtest_java_application.pydiff 1017:887a4bbabf1e Tue Mar 26 20:38:00 UTC 2019 Andrey Zelenkov <zelenkov@nginx.com> Tests: style.
/unit/src/
H A Dnxt_router.hdiff 119:22bc18e61479 Thu Jul 06 15:38:00 UTC 2017 Max Romanov <max.romanov@nginx.com> Router: read configuration from port.

Controller: stub to send configuration from POST body "as is" to router.
H A Dnxt_router.cdiff 2230:83b2d20d8f5c Fri Sep 16 13:38:00 UTC 2022 Andrew Clayton <a.clayton@nginx.com> PHP: allowed to specify URLs without a trailing '/'.

Both @lucatacconi & @mwoodpatrick reported what appears to be the same
issue on GitHub. Namely that when using the PHP language module and
trying to access a URL that is a directory but without specifying the
trailing '/', they were getting a '503 Service Unavailable' error.

Note: This is when _not_ using the 'script' option.

E.g with the following config

{
"listeners": {
"[::1]:8080": {
"pass": "applications/php"
}
},

"applications": {
"php": {
"type": "php",
"root": "/var/tmp/unit-php"
}
}
}

and with a directory path of /var/tmp/unit-php/foo containing an
index.php, you would see the following

$ curl http://localhost/foo
<title>Error 503</title>
Error 503

However

$ curl http://localhost/foo/

would work and serve up the index.php

This commit fixes the above so you get the desired behaviour without
specifying the trailing '/' by doing the following

1] If the URL doesn't end in .php and doesn't have a trailing '/'
then check if the requested path is a directory.

2) If it is a directory then create a 301 re-direct pointing to it.
This matches the behaviour of the likes of nginx, Apache and
lighttpd.

This also matches the behaviour of the "share" action in Unit.

This doesn't effect the behaviour of the 'script' option which bypasses
the nxt_php_dynamic_request() function.

This also adds a couple of tests to test/test_php_application.py to
ensure this continues to work.

Closes: <https://github.com/nginx/unit/issues/717>
Closes: <https://github.com/nginx/unit/issues/753>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
diff 615:38d50cba8f00 Thu Apr 05 14:19:00 UTC 2018 Max Romanov <max.romanov@nginx.com> Stopping timed out application process.
diff 424:38b478d79178 Wed Dec 27 14:46:00 UTC 2017 Max Romanov <max.romanov@nginx.com> Changing worker selection precedence.

This patch increase precedence of non-started worker over busy worker.

1. idle worker;
2. start new worker;
3. busy worker, but can accept request in advance;
diff 317:94010c8bd7bc Fri Sep 15 11:38:00 UTC 2017 Valentin Bartenev <vbart@nginx.com> Fixed port handlers arrays.
diff 119:22bc18e61479 Thu Jul 06 15:38:00 UTC 2017 Max Romanov <max.romanov@nginx.com> Router: read configuration from port.

Controller: stub to send configuration from POST body "as is" to router.
diff 58:506c889e2682 Fri Jun 09 18:38:00 UTC 2017 Valentin Bartenev <vbart@nginx.com> Fixed building by GCC 7 (broken in 0b10a73d4993).
H A Dnxt_http_variables.cdiff 2110:048281cd3d73 Thu May 26 12:38:00 UTC 2022 Alejandro Colomar <alx.manpages@gmail.com> Var: Added $request_uri (as in NGINX).

This supports a new variable $request_uri that contains the path
and the query (See RFC 3986, section 3). Its contents are percent
encoded. This is useful for example to redirect HTTP to HTTPS:

{
"return": "301",
"location": "https://$host$request_uri"
}

When <http://example.com/foo%23bar?baz> is requested, the server
redirects to <https://example.com/foo%23bar?baz>.

===

Testing:

//diff --git a/src/nxt_http_return.c b/src/nxt_http_return.c
//index 82c9156..adeb3a1 100644
//--- a/src/nxt_http_return.c
//+++ b/src/nxt_http_return.c
//@@ -196,6 +196,7 @@ nxt_http_return_send_ready(nxt_task_t *task,
void *obj, void *data)
// field->value = ctx->encoded.start;
// field->value_length = ctx->encoded.length;
// }
//+ fprintf(stderr, "ALX: target[%1$i]: <%2$.*1$s>\n",
(int)r->target.length, r->target.start);
//
// r->state = &nxt_http_return_send_state;
//

{
"listeners": {
"*:81": {
"pass": "routes/ru"
}
},

"routes": {
"ru": [{
"action": {
"return": 301,
"location": "$request_uri"
}
}]
}
}

$ curl -i http://localhost:81/*foo%2Abar?baz#arg
HTTP/1.1 301 Moved Permanently
Location: /*foo%2Abar?baz
Server: Unit/1.27.0
Date: Mon, 30 May 2022 16:04:30 GMT
Content-Length: 0

$ sudo cat /usr/local/unit.log | grep ALX
ALX: target[15]: </*foo%2Abar?baz>
H A Dnxt_application.hdiff 615:38d50cba8f00 Thu Apr 05 14:19:00 UTC 2018 Max Romanov <max.romanov@nginx.com> Stopping timed out application process.
H A Dnxt_php_sapi.cdiff 2230:83b2d20d8f5c Fri Sep 16 13:38:00 UTC 2022 Andrew Clayton <a.clayton@nginx.com> PHP: allowed to specify URLs without a trailing '/'.

Both @lucatacconi & @mwoodpatrick reported what appears to be the same
issue on GitHub. Namely that when using the PHP language module and
trying to access a URL that is a directory but without specifying the
trailing '/', they were getting a '503 Service Unavailable' error.

Note: This is when _not_ using the 'script' option.

E.g with the following config

{
"listeners": {
"[::1]:8080": {
"pass": "applications/php"
}
},

"applications": {
"php": {
"type": "php",
"root": "/var/tmp/unit-php"
}
}
}

and with a directory path of /var/tmp/unit-php/foo containing an
index.php, you would see the following

$ curl http://localhost/foo
<title>Error 503</title>
Error 503

However

$ curl http://localhost/foo/

would work and serve up the index.php

This commit fixes the above so you get the desired behaviour without
specifying the trailing '/' by doing the following

1] If the URL doesn't end in .php and doesn't have a trailing '/'
then check if the requested path is a directory.

2) If it is a directory then create a 301 re-direct pointing to it.
This matches the behaviour of the likes of nginx, Apache and
lighttpd.

This also matches the behaviour of the "share" action in Unit.

This doesn't effect the behaviour of the 'script' option which bypasses
the nxt_php_dynamic_request() function.

This also adds a couple of tests to test/test_php_application.py to
ensure this continues to work.

Closes: <https://github.com/nginx/unit/issues/717>
Closes: <https://github.com/nginx/unit/issues/753>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
diff 1376:2ecb15904ba5 Tue Mar 03 14:38:00 UTC 2020 Tiago Natel de Moura <t.nateldemoura@f5.com> PHP: optimization to avoid surplus chdir(2) calls.

For each request, the worker calls the php_execute_script function
from libphp that changes to the script directory before doing its
work and then restores the process directory before returning. The
chdir(2) calls it performs are unnecessary in Unit design. In simple
benchmarks, profiling shows that the chdir syscall code path (syscall,
FS walk, etc.) is where the CPU spends most of its time.

PHP SAPI semantics requires the script to be run from the script
directory. In Unit's PHP implementation, we have two use cases:

- script
- arbitrary path

The "script" configuration doesn't have much need for a working
directory change: it can be changed once at module initialization.
The module needs to chdir again only if the user's PHP script also
calls chdir to switch to another directory during execution.

If "script" is not used in Unit configuration, we must ensure the
script is run from its directory (thus calling chdir before exec),
but there's no need to restore the working directory later.

Our implementation disables mandatory chdir calls with the SAPI
option SAPI_OPTION_NO_CHDIR, instead calling chdir only when needed.

To detect the user's calls to chdir, a simple "unit" extension is
added that hooks the built-in chdir() PHP call.
H A Dnxt_openssl.cdiff 2223:1019031754fe Wed Jan 16 07:38:00 UTC 2019 Remi Collet <remi@remirepo.net> Preferring system crypto policy.

If we don't call SSL_CTX_set_cipher_list(), then it uses the
system's default.

Link: <https://fedoraproject.org/wiki/Changes/CryptoPolicy>
Link: <https://docs.fedoraproject.org/en-US/packaging-guidelines/CryptoPolicies/>
Link: <https://www.redhat.com/en/blog/consistent-security-crypto-policies-red-hat-enterprise-linux-8>
Signed-off-by: Remi Collet <remi@remirepo.net>
Acked-by: Andrei Belov <defan@nginx.com>
[ alx: add changelog and tweak commit message ]
Signed-off-by: Alejandro Colomar <alx@nginx.com>
H A Dnxt_http_parse.cdiff 38:c47bca12f947 Tue Apr 25 13:57:00 UTC 2017 Valentin Bartenev <vbart@nginx.com> HTTP parser: fixed minimum length optimization in headers hash.
diff 19:385969e9f503 Tue Mar 07 21:38:00 UTC 2017 Valentin Bartenev <vbart@nginx.com> More optimizations of HTTP parser.

SSE 4.2 code removed, since loop unrolling gives better results.
H A Dnxt_controller.cdiff 317:94010c8bd7bc Fri Sep 15 11:38:00 UTC 2017 Valentin Bartenev <vbart@nginx.com> Fixed port handlers arrays.
diff 119:22bc18e61479 Thu Jul 06 15:38:00 UTC 2017 Max Romanov <max.romanov@nginx.com> Router: read configuration from port.

Controller: stub to send configuration from POST body "as is" to router.
H A Dnxt_h1proto.cdiff 626:210b94412f8d Tue Apr 10 16:38:00 UTC 2018 Igor Sysoev <igor@sysoev.ru> Added "408 Request Timeout" error response.
diff 625:f6db55355ece Tue Apr 10 16:38:00 UTC 2018 Igor Sysoev <igor@sysoev.ru> Refactored HTTP header parsing.
H A Dnxt_unit_request.hdiff 2230:83b2d20d8f5c Fri Sep 16 13:38:00 UTC 2022 Andrew Clayton <a.clayton@nginx.com> PHP: allowed to specify URLs without a trailing '/'.

Both @lucatacconi & @mwoodpatrick reported what appears to be the same
issue on GitHub. Namely that when using the PHP language module and
trying to access a URL that is a directory but without specifying the
trailing '/', they were getting a '503 Service Unavailable' error.

Note: This is when _not_ using the 'script' option.

E.g with the following config

{
"listeners": {
"[::1]:8080": {
"pass": "applications/php"
}
},

"applications": {
"php": {
"type": "php",
"root": "/var/tmp/unit-php"
}
}
}

and with a directory path of /var/tmp/unit-php/foo containing an
index.php, you would see the following

$ curl http://localhost/foo
<title>Error 503</title>
Error 503

However

$ curl http://localhost/foo/

would work and serve up the index.php

This commit fixes the above so you get the desired behaviour without
specifying the trailing '/' by doing the following

1] If the URL doesn't end in .php and doesn't have a trailing '/'
then check if the requested path is a directory.

2) If it is a directory then create a 301 re-direct pointing to it.
This matches the behaviour of the likes of nginx, Apache and
lighttpd.

This also matches the behaviour of the "share" action in Unit.

This doesn't effect the behaviour of the 'script' option which bypasses
the nxt_php_dynamic_request() function.

This also adds a couple of tests to test/test_php_application.py to
ensure this continues to work.

Closes: <https://github.com/nginx/unit/issues/717>
Closes: <https://github.com/nginx/unit/issues/753>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
/unit/docs/
H A Dchanges.xmldiff 2230:83b2d20d8f5c Fri Sep 16 13:38:00 UTC 2022 Andrew Clayton <a.clayton@nginx.com> PHP: allowed to specify URLs without a trailing '/'.

Both @lucatacconi & @mwoodpatrick reported what appears to be the same
issue on GitHub. Namely that when using the PHP language module and
trying to access a URL that is a directory but without specifying the
trailing '/', they were getting a '503 Service Unavailable' error.

Note: This is when _not_ using the 'script' option.

E.g with the following config

{
"listeners": {
"[::1]:8080": {
"pass": "applications/php"
}
},

"applications": {
"php": {
"type": "php",
"root": "/var/tmp/unit-php"
}
}
}

and with a directory path of /var/tmp/unit-php/foo containing an
index.php, you would see the following

$ curl http://localhost/foo
<title>Error 503</title>
Error 503

However

$ curl http://localhost/foo/

would work and serve up the index.php

This commit fixes the above so you get the desired behaviour without
specifying the trailing '/' by doing the following

1] If the URL doesn't end in .php and doesn't have a trailing '/'
then check if the requested path is a directory.

2) If it is a directory then create a 301 re-direct pointing to it.
This matches the behaviour of the likes of nginx, Apache and
lighttpd.

This also matches the behaviour of the "share" action in Unit.

This doesn't effect the behaviour of the 'script' option which bypasses
the nxt_php_dynamic_request() function.

This also adds a couple of tests to test/test_php_application.py to
ensure this continues to work.

Closes: <https://github.com/nginx/unit/issues/717>
Closes: <https://github.com/nginx/unit/issues/753>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
diff 2223:1019031754fe Wed Jan 16 07:38:00 UTC 2019 Remi Collet <remi@remirepo.net> Preferring system crypto policy.

If we don't call SSL_CTX_set_cipher_list(), then it uses the
system's default.

Link: <https://fedoraproject.org/wiki/Changes/CryptoPolicy>
Link: <https://docs.fedoraproject.org/en-US/packaging-guidelines/CryptoPolicies/>
Link: <https://www.redhat.com/en/blog/consistent-security-crypto-policies-red-hat-enterprise-linux-8>
Signed-off-by: Remi Collet <remi@remirepo.net>
Acked-by: Andrei Belov <defan@nginx.com>
[ alx: add changelog and tweak commit message ]
Signed-off-by: Alejandro Colomar <alx@nginx.com>
diff 2110:048281cd3d73 Thu May 26 12:38:00 UTC 2022 Alejandro Colomar <alx.manpages@gmail.com> Var: Added $request_uri (as in NGINX).

This supports a new variable $request_uri that contains the path
and the query (See RFC 3986, section 3). Its contents are percent
encoded. This is useful for example to redirect HTTP to HTTPS:

{
"return": "301",
"location": "https://$host$request_uri"
}

When <http://example.com/foo%23bar?baz> is requested, the server
redirects to <https://example.com/foo%23bar?baz>.

===

Testing:

//diff --git a/src/nxt_http_return.c b/src/nxt_http_return.c
//index 82c9156..adeb3a1 100644
//--- a/src/nxt_http_return.c
//+++ b/src/nxt_http_return.c
//@@ -196,6 +196,7 @@ nxt_http_return_send_ready(nxt_task_t *task,
void *obj, void *data)
// field->value = ctx->encoded.start;
// field->value_length = ctx->encoded.length;
// }
//+ fprintf(stderr, "ALX: target[%1$i]: <%2$.*1$s>\n",
(int)r->target.length, r->target.start);
//
// r->state = &nxt_http_return_send_state;
//

{
"listeners": {
"*:81": {
"pass": "routes/ru"
}
},

"routes": {
"ru": [{
"action": {
"return": 301,
"location": "$request_uri"
}
}]
}
}

$ curl -i http://localhost:81/*foo%2Abar?baz#arg
HTTP/1.1 301 Moved Permanently
Location: /*foo%2Abar?baz
Server: Unit/1.27.0
Date: Mon, 30 May 2022 16:04:30 GMT
Content-Length: 0

$ sudo cat /usr/local/unit.log | grep ALX
ALX: target[15]: </*foo%2Abar?baz>
diff 1951:863363011a94 Tue Aug 24 11:38:00 UTC 2021 Valentin Bartenev <vbart@nginx.com> Version bump.
diff 1820:e969cea13cc3 Wed Mar 24 13:38:00 UTC 2021 Valentin Bartenev <vbart@nginx.com> Certficates: fixed counting DNS SAN entries.

Previously, entries of any type were counted during object allocation
but only DNS type entries were actually processed. As a result,
if some certificate entries had another type, returning information
about the certificate caused uninitialized memory access.
diff 441:2206b023fae3 Thu Dec 28 17:38:00 UTC 2017 Andrei Belov <defan@nginx.com> Packages: added support for Ubuntu 17.10.
/unit/auto/
H A Doptionsdiff 225:6f59f917d940 Thu Aug 24 15:38:00 UTC 2017 Igor Sysoev <igor@sysoev.ru> Renamed configure option --no-unix-domain to --no-unix-sockets.
H A Dmakediff 304:2bd8a353a59d Thu Sep 07 23:38:00 UTC 2017 Max Romanov <max.romanov@nginx.com> Decalring clean and dist targets as .PHONY.
/unit/pkg/rpm/
H A Dunit.spec.indiff 443:2b933f0bc77d Thu Dec 28 17:38:00 UTC 2017 Andrei Belov <defan@nginx.com> Packages: hardening flags for rpm.
H A Dunit.module.spec.indiff 443:2b933f0bc77d Thu Dec 28 17:38:00 UTC 2017 Andrei Belov <defan@nginx.com> Packages: hardening flags for rpm.
/unit/pkg/deb/
H A DMakefilediff 441:2206b023fae3 Thu Dec 28 17:38:00 UTC 2017 Andrei Belov <defan@nginx.com> Packages: added support for Ubuntu 17.10.
diff 440:759444c75bce Thu Dec 28 17:38:00 UTC 2017 Andrei Belov <defan@nginx.com> Packages: added python 3.4 module on Debian 8.
/unit/auto/modules/
H A Dphpdiff 1376:2ecb15904ba5 Tue Mar 03 14:38:00 UTC 2020 Tiago Natel de Moura <t.nateldemoura@f5.com> PHP: optimization to avoid surplus chdir(2) calls.

For each request, the worker calls the php_execute_script function
from libphp that changes to the script directory before doing its
work and then restores the process directory before returning. The
chdir(2) calls it performs are unnecessary in Unit design. In simple
benchmarks, profiling shows that the chdir syscall code path (syscall,
FS walk, etc.) is where the CPU spends most of its time.

PHP SAPI semantics requires the script to be run from the script
directory. In Unit's PHP implementation, we have two use cases:

- script
- arbitrary path

The "script" configuration doesn't have much need for a working
directory change: it can be changed once at module initialization.
The module needs to chdir again only if the user's PHP script also
calls chdir to switch to another directory during execution.

If "script" is not used in Unit configuration, we must ensure the
script is run from its directory (thus calling chdir before exec),
but there's no need to restore the working directory later.

Our implementation disables mandatory chdir calls with the SAPI
option SAPI_OPTION_NO_CHDIR, instead calling chdir only when needed.

To detect the user's calls to chdir, a simple "unit" extension is
added that hooks the built-in chdir() PHP call.

123