History log of /unit/test/ (Results 51 – 75 of 616)
Revision (<<< Hide revision tags) (Show revision tags >>>)Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
2373:90a27a4ee2d614-Mar-2023 Andrei Zeliankou

Tests: added Perl test with many responses using streaming body.

2370:8a7f258f073007-Mar-2023 Andrei Zeliankou

Tests: _clear_temp_dir() function introduced.

Also added temporary directory clearing after checking available
modules to prevent garbage environment when tests start.

Revision tags: 1.29.1-1, 1.29.1
2353:c7875ab2fcd621-Feb-2023 Andrei Zeliankou

Tests: added Python tests with encoding.

2341:66afc2b8d6c207-Nov-2022 Andrew Clayton

PHP: Fix a potential problem parsing the path.

@dward on GitHub reported an issue with a URL like

http://foo.bar/test.php?blah=test.php/foo

where we would end up trying to run the script

test

PHP: Fix a potential problem parsing the path.

@dward on GitHub reported an issue with a URL like

http://foo.bar/test.php?blah=test.php/foo

where we would end up trying to run the script

test.php?blah=test.php

In the PHP module the format 'file.php/' is treated as a special case in
nxt_php_dynamic_request() where we check the _path_ part of the url for
the string '.php/'.

The problem is that the path actually also contains the query string,
thus we were finding 'test.php/' in the above URL and treating that
whole path as the script to run.

The fix is simple, replace the strstr(3) with a memmem(3), where we can
limit the amount of path we use for the check.

The trick here and what is not obvious from the code is that while
path.start points to the whole path including the query string,
path.length only contains the length of the _path_ part.

NOTE: memmem(3) is a GNU extension and is neither specified by POSIX or
ISO C, however it is available on a number of other systems, including:
FreeBSD, OpenBSD, NetBSD, illumos, and macOS.

If it comes to it we can implement a simple alternative for systems
which lack memmem(3).

This also adds a test case (provided by @dward) to cover this.

Closes: <https://github.com/nginx/unit/issues/781>
Cc: Andrei Zeliankou <zelenkov@nginx.com>
Reviewed-by: Alejandro Colomar <alx@nginx.com>
Reviewed-by: Andrei Zeliankou <zelenkov@nginx.com> [test]
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>

show more ...

2330:4b1f175f9c8821-Feb-2023 Andrei Zeliankou

Tests: switched to using f-strings.

Previously, it was necessary to support older versions of Python for
compatibility. F-strings were released in Python 3.6. Python 3.5 was
marked as unsupported

Tests: switched to using f-strings.

Previously, it was necessary to support older versions of Python for
compatibility. F-strings were released in Python 3.6. Python 3.5 was
marked as unsupported by the end of 2020, so now it's possible to start
using f-strings safely for better readability and performance.

show more ...


conftest.py
python/environment/wsgi.py
python/input_readline_size/wsgi.py
python/lifespan/empty/asgi.py
python/targets/wsgi.py
python/threading/asgi.py
python/threading/wsgi.py
python/unicode/wsgi.py
test_access_log.py
test_asgi_application.py
test_asgi_application_unix_abstract.py
test_asgi_lifespan.py
test_asgi_targets.py
test_asgi_websockets.py
test_client_ip.py
test_configuration.py
test_go_application.py
test_go_isolation.py
test_http_header.py
test_java_application.py
test_java_isolation_rootfs.py
test_java_websockets.py
test_njs.py
test_node_application.py
test_node_websockets.py
test_php_application.py
test_php_targets.py
test_proxy.py
test_proxy_chunked.py
test_python_application.py
test_python_environment.py
test_python_isolation.py
test_python_isolation_chroot.py
test_python_procman.py
test_python_targets.py
test_respawn.py
test_return.py
test_routing.py
test_ruby_hooks.py
test_settings.py
test_static.py
test_static_chroot.py
test_static_fallback.py
test_static_mount.py
test_static_share.py
test_static_symlink.py
test_static_types.py
test_static_variables.py
test_status.py
test_tls.py
test_tls_conf_command.py
test_tls_sni.py
test_tls_tickets.py
test_unix_abstract.py
test_upstreams_rr.py
test_usr1.py
test_variables.py
unit/applications/lang/go.py
unit/applications/lang/java.py
unit/applications/lang/node.py
unit/applications/lang/perl.py
unit/applications/lang/php.py
unit/applications/lang/python.py
unit/applications/lang/ruby.py
unit/applications/tls.py
unit/applications/websockets.py
unit/check/chroot.py
unit/check/isolation.py
unit/check/node.py
unit/check/unix_abstract.py
unit/control.py
unit/http.py
unit/log.py
unit/utils.py
2329:163d6e322d3221-Feb-2023 Andrei Zeliankou

Tests: added Python tests with encoding.

2328:72295f67689c21-Feb-2023 Andrei Zeliankou

Tests: removed list usage as default argument.

Mutable types as default arguments is bad practice since
they are evaluated only once when the function is defined.

2314:bc5a90e2e6e814-Jul-2022 Alejandro Colomar

Added default values for pathnames.

This allows one to simply run `./configure` and expect it to
produce sane defaults for an install.

Previously, without specifying `--prefix=...`, `make install`

Added default values for pathnames.

This allows one to simply run `./configure` and expect it to
produce sane defaults for an install.

Previously, without specifying `--prefix=...`, `make install`
would simply fail, recommending to set `--prefix` or `DESTDIR`,
but that recommendation was incomplete at best, since it didn't
set many of the subdirs needed for a good organization.

Setting `DESTDIR` was even worse, since that shouldn't even affect
an installation (it is required to be transparent to the
installation).

/usr/local is the historic Unix standard path to use for
installations from source made manually by the admin of the
system. Some package managers (Homebrew, I'm looking specifically
at you) have abused that path to install their things, but 1) it's
not our fault that someone else incorrectly abuses that path (and
they seem to be fixing it for newer archs; e.g., they started
using /opt/homebrew for Apple Silicon), 2) there's no better path
than /usr/local, 3) we still allow changing it for systems where
this might not be the desired path (MacOS Intel with hombrew), and
4) it's _the standard_.

See a related conversation with Ingo (OpenBSD maintainer):

On 7/27/22 16:16, Ingo Schwarze wrote:
> Hi Alejandro,
[...]
>
> Alejandro Colomar wrote on Sun, Jul 24, 2022 at 07:07:18PM +0200:
>> On 7/24/22 16:57, Ingo Schwarze wrote:
>>> Alejandro Colomar wrote on Sun, Jul 24, 2022 at 01:20:46PM +0200:
>
>>>> /usr/local is for sysadmins to build from source;
>
>>> Doing that is *very* strongly discouraged on OpenBSD.
>
>> I guess that's why the directory was reused in the BSDs to install ports
>> (probably ports were installed by the sysadmin there, and by extension,
>> ports are now always installed there, but that's just a guess).
>
> Maybe. In any case, the practice of using /usr/local for packages
> created from ports is significantly older than the recommendation
> to refrain from using upstream "make install" outside the ports
> framework.
>
> * The FreeBSD ports framework was started by Jordan Hubbard in 1993.
> * The ports framework was ported from FreeBSD to OpenBSD
> by Niklas Hallqvist in 1996.
> * NetBSD pkgsrc was forked from FreeBSD ports by Alistair G. Crooks
> and Hubert Feyrer in 1997.
>
> I failed to quickly find Jordan's original version, but rev. 1.1
> of /usr/ports/infrastructure/mk/bsd.port.mk in OpenBSD (dated Jun 3
> 22:47:10 1996 UTC) already said
>
> LOCALBASE ?= /usr/local
> PREFIX ?= ${LOCALBASE}
>
[...]
>> I had a discussion in NGINX Unit about it, and
>> the decission for now has been: "support prefix=/usr/local for default
>> manual installation through the Makefile, and let BSD users adjust to
>> their preferred path".
>
> That's an *excellent* solution for the task, thanks for doing it
> the right way. By setting PREFIX=/usr/local by default in the
> upstream Makefile, you are minimizing the work for *BSD porters.
>
> The BSD ports frameworks will typically run the upstreak "make install"
> with the variable DESTDIR set to a custom value, for example
>
> DESTDIR=/usr/ports/pobj/groff-1.23.0/fake-amd64
>
> so if the upstream Makefile sets PREFIX=/usr/local ,
> that's perfect, everything gets installed to the right place
> without an intervention by the person doing the porting.
>
> Of course, if the upstream Makefile would use some other PREFIX,
> that would not be a huge obstacle. All we have to do in that case
> is pass the option --prefix=/usr/local to the ./configure script,
> or something equivalent if the software isn't using GNU configure.
>
>> We were concerned that we might get collisions
>> with the BSD port also installing in /usr/local, but that's the least
>> evil (and considering BSD users don't typically run `make install`, it's
>> not so bad).
>
> It's not bad at all. It's perfect.
>
> Of course, if a user wants to install *without* the ports framework,
> they have to provide their own --prefix. But that's not an issue
> because it is easy to do, and installing without a port is discouraged
> anyway.

===

Directory variables should never contain a trailing slash (I've
learned that the hard way, where some things would break
unexpectedly). Especially, make(1) is likely to have problems
when things have double slashes or a trailing slash, since it
treats filenames as text strings. I've removed the trailing slash
from the prefix, and added it to the derivate variables just after
the prefix. pkg-config(1) also expects directory variables to have
no trailing slash.

===

I also removed the code that would set variables as depending on
the prefix if they didn't start with a slash, because that is a
rather non-obvious behavior, and things should not always depend
on prefix, but other dirs such as $(runstatedir), so if we keep
a similar behavior it would be very unreliable. Better keep
variables intact if set, or use the default if unset.

===

Print the real defaults for ./configure --help, rather than the actual
values.

===

I used a subdirectory under the standard /var/lib for NXT_STATE,
instead of a homemade "state" dir that does the same thing.

===

Modified the Makefile to create some dirs that weren't being
created, and also remove those that weren't being removed in
uninstall, probably because someone forgot to add them.

===

Add new options for setting the new variables, and rename some to be
consistent with the standard names. Keep the old ones at configuration
time for compatibility, but mark them as deprecated. Don't keep the old
ones at exec time.

===

A summary of the default config is:

Unit configuration summary:

bin directory: ............. "/usr/local/bin"
sbin directory: ............ "/usr/local/sbin"
lib directory: ............. "/usr/local/lib"
include directory: ......... "/usr/local/include"
man pages directory: ....... "/usr/local/share/man"
modules directory: ......... "/usr/local/lib/unit/modules"
state directory: ........... "/usr/local/var/lib/unit"
tmp directory: ............. "/tmp"

pid file: .................. "/usr/local/var/run/unit/unit.pid"
log file: .................. "/usr/local/var/log/unit/unit.log"

control API socket: ........ "unix:/usr/local/var/run/unit/control.unit.sock"

Link: <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>
Link: <https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html>
Reviewed-by: Artem Konev <a.konev@f5.com>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Tested-by: Andrew Clayton <a.clayton@nginx.com>
Reviewed-by: Konstantin Pavlov <thresh@nginx.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>

show more ...

2313:62f45cfd957b26-Jan-2023 Andrew Clayton

Tests: Add some PHP tests for 403 and 404 error handling.

Since the previous commit, we now properly handle 403 Forbidden & 404
Not Found errors in the PHP language module.

This adds a test for 403

Tests: Add some PHP tests for 403 and 404 error handling.

Since the previous commit, we now properly handle 403 Forbidden & 404
Not Found errors in the PHP language module.

This adds a test for 403 Forbidden to test/test_php_application.py, but
also fixes a test in test/test_php_targets.py where we were checking for
503 but should have been a 404, which we now do.

Acked-by: Alejandro Colomar <alx@nginx.com>
Cc: Andrei Zeliankou <zelenkov@nginx.com>
[ Incorporates a couple of small test cleanups from Andrei ]
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>

show more ...

2308:a2439944be7924-Jan-2023 Andrei Zeliankou

Tests: added NJS iteration tests.

2307:eca149dfeb2124-Jan-2023 Andrei Zeliankou

Tests: NJS tests reworked.

2303:5ae42a44e2ab07-Nov-2022 Andrew Clayton

PHP: Fix a potential problem parsing the path.

@dward on GitHub reported an issue with a URL like

http://foo.bar/test.php?blah=test.php/foo

where we would end up trying to run the script

test

PHP: Fix a potential problem parsing the path.

@dward on GitHub reported an issue with a URL like

http://foo.bar/test.php?blah=test.php/foo

where we would end up trying to run the script

test.php?blah=test.php

In the PHP module the format 'file.php/' is treated as a special case in
nxt_php_dynamic_request() where we check the _path_ part of the url for
the string '.php/'.

The problem is that the path actually also contains the query string,
thus we were finding 'test.php/' in the above URL and treating that
whole path as the script to run.

The fix is simple, replace the strstr(3) with a memmem(3), where we can
limit the amount of path we use for the check.

The trick here and what is not obvious from the code is that while
path.start points to the whole path including the query string,
path.length only contains the length of the _path_ part.

NOTE: memmem(3) is a GNU extension and is neither specified by POSIX or
ISO C, however it is available on a number of other systems, including:
FreeBSD, OpenBSD, NetBSD, illumos, and macOS.

If it comes to it we can implement a simple alternative for systems
which lack memmem(3).

This also adds a test case (provided by @dward) to cover this.

Closes: <https://github.com/nginx/unit/issues/781>
Cc: Andrei Zeliankou <zelenkov@nginx.com>
Reviewed-by: Alejandro Colomar <alx@nginx.com>
Reviewed-by: Andrei Zeliankou <zelenkov@nginx.com> [test]
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>

show more ...

Revision tags: 1.29.0-1, 1.29.0
2278:f141932b061614-Dec-2022 Andrei Zeliankou

Tests: added tests for "path" option in isolation/cgroup.

2273:a13c26f6247714-Nov-2021 OutOfFocus4

Python: Added "prefix" to configuration.

This patch gives users the option to set a `"prefix"` attribute
for Python applications, either at the top level or for specific
`"target"`s. If the attribut

Python: Added "prefix" to configuration.

This patch gives users the option to set a `"prefix"` attribute
for Python applications, either at the top level or for specific
`"target"`s. If the attribute is present, the value of `"prefix"`
must be a string beginning with `"/"`. If the value of the `"prefix"`
attribute is longer than 1 character and ends in `"/"`, the
trailing `"/"` is stripped.

The purpose of the `"prefix"` attribute is to set the `SCRIPT_NAME`
context value for WSGI applications and the `root_path` context
value for ASGI applications, allowing applications to properly route
requests regardless of the path that the server uses to expose the
application.

The context value is only set if the request's URL path begins with
the value of the `"prefix"` attribute. In all other cases, the
`SCRIPT_NAME` or `root_path` values are not set. In addition, for
WSGI applications, the value of `"prefix"` will be stripped from
the beginning of the request's URL path before it is sent to the
application.

Reviewed-by: Andrei Zeliankou <zelenkov@nginx.com>
Reviewed-by: Artem Konev <artem.konev@nginx.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>

show more ...

2271:ccaca37def8714-Dec-2022 "Sergey A. Osokin"

Java: upgrading third-party components.

2267:63ddc009376813-Dec-2022 Andrei Zeliankou

Tests: added tests for the large header buffer settings.

Added tests for the "large_header_buffer_size" and
"large_header_buffers" configuration options.

2264:d782ff4b92c412-Dec-2022 Andrei Zeliankou

Tests: stop execution if can't unmount any filesystem.

2263:f9f47ce8631512-Dec-2022 Andrei Zeliankou

Tests: pretty output.

Hide expected alerts by default.
Silence succesfull "go build" information.

2257:e9dcaa07849c09-Dec-2022 Andrei Zeliankou

Tests: fixed tests to run as privileged user.

2249:06504073b11829-Nov-2022 Andrei Zeliankou

Tests: NJS.

2243:dd668fe8d82720-Nov-2022 Zhidao HONG

Var: improved variable parsing with empty names.

Unit parsed the case of "$uri$$host" into unknown variables.
This commit makes it invalid variable instead.

2238:07d98e14149215-Nov-2022 Andrei Zeliankou

Tests: fixed _check_processes() checks in "--restart" mode.

2237:20ca039760b215-Nov-2022 Andrei Zeliankou

Tests: removed migration test.

Migration of "share" behaviour was dropped after b57b4749b993.

2236:a0d15bc96b3c15-Nov-2022 Andrei Zeliankou

Tests: fixed assertion in test_variables_dynamic.

2235:a54509bf68c315-Nov-2022 Andrei Zeliankou

Tests: features and options checks improved.

Now version output evaluates only once.
OpenSSL checks more carefully.

12345678910>>...25