Commit Graph

44 Commits

Author SHA1 Message Date
Andrei Zeliankou
2ad03caf32 Tests: added tests for response header variables. 2023-07-11 15:51:53 +01:00
Andrei Zeliankou
7934dcabbc 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.
2023-02-21 17:21:29 +00:00
Andrei Zeliankou
fcabbf09d8 Tests: added Python tests with encoding. 2023-02-21 15:35:38 +00:00
OutOfFocus4
6dae517ebd 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>
2022-12-14 11:30:30 +01:00
Andrei Zeliankou
c65e04682e Tests: minor fixes. 2022-09-07 01:11:04 +01:00
Zhidao HONG
045c05e468 Tests: forwarded header replacement tests. 2022-06-20 17:19:35 +08:00
Andrei Zeliankou
0f72534660 Tests: style. 2022-04-11 21:05:14 +01:00
Andrei Zeliankou
39adb292d5 Tests: style. 2021-10-18 01:10:11 +01:00
Oisin Canty
039d032dd6 Tests: client IP address replacement. 2021-08-12 08:23:23 +00:00
Max Romanov
fa9fb29be2 Application restart introduced.
When processing a restart request, the router sends a QUIT message to all
existing processes of the application.  Then, a new shared application port is
created to ensure that new requests won't be handled by the old processes of
the application.
2021-07-29 19:50:39 +03:00
Andrei Zeliankou
1154ede862 Tests: test_settings_send_timeout improved.
Data length adjusts depending on socket buffer size when it's possible.
2021-05-24 05:26:15 +01:00
Oisin Canty
e50bb120e2 Tests: Python targets. 2021-05-20 13:03:12 +00:00
Andrei Zeliankou
6c97a1a069 Tests: style. 2021-04-05 14:03:05 +01:00
Andrei Zeliankou
42725137f7 Tests: added tests for "path" option in Python application. 2021-02-04 15:09:54 +00:00
Andrei Zeliankou
18ddb74772 Tests: added tests for a "discard_unsafe_fields" option. 2020-11-19 05:21:48 +00:00
Max Romanov
5fd2933d2e Python: supporting ASGI legacy protocol.
Introducing manual protocol selection for 'universal' apps and frameworks.
2020-11-10 22:27:08 +03:00
Max Romanov
f27953af61 Tests: added Python threading tests. 2020-11-05 00:05:02 +03:00
Andrei Zeliankou
152ad526f4 Tests: added ASGI Lifespan. 2020-10-05 11:05:00 +01:00
Max Romanov
12f225a43a Tests: added ASGI HTTP applications. 2020-10-01 23:55:43 +03:00
Max Romanov
d97e3a3296 Tests: added ASGI WebSocket. 2020-10-01 23:55:35 +03:00
Max Romanov
af964488ba Tests: changing Python application callable name. 2020-09-21 10:32:14 +03:00
Tiago Natel de Moura
08b765ae42 Tests: Added rootfs tests. 2020-05-28 14:59:52 +01:00
Andrei Zeliankou
a49023229e Tests: use "return" action in upstream tests. 2020-04-03 01:49:18 +01:00
Max Romanov
ab7b42a072 Handling change file message in libunit.
This is required for proper log file rotation action.
2020-03-30 14:18:41 +03:00
Max Romanov
f3e6726098 Tests: added Python input readline and iterator tests. 2020-03-12 17:54:15 +03:00
Andrei Zeliankou
1d75277767 Tests: round robin upstream tests. 2020-03-12 13:47:43 +00:00
Tiago Natel de Moura
12e15ba43b Tests: added test for uploading files with SSL.
* * *
[mq]: multipart
2020-02-05 13:29:41 +00:00
Tiago Natel
c6a11260e8 Tests: added tests for setting user and group. 2019-11-11 14:36:22 +00:00
Andrei Zeliankou
1072c94829 Tests: Python exception tests. 2019-11-14 18:46:28 +03:00
Andrei Zeliankou
c7726c0eb1 Tests: proxy tests. 2019-11-14 17:15:29 +03:00
Andrei Zeliankou
45d75ee2cb Tests: added Python test with threading. 2019-11-13 16:51:12 +03:00
Andrey Zelenkov
38cfe4cf3d Tests: added USR1 signal test for unit.log. 2019-10-23 16:59:53 +03:00
Andrey Zelenkov
1bece759a3 Tests: added flush() in "errors_write" Python application. 2019-10-23 16:05:35 +03:00
Andrey Zelenkov
29b4e4431f Tests: speed up tests. 2019-04-09 20:59:35 +03:00
Andrey Zelenkov
4b92586530 Tests: "Host" header tests. 2019-02-27 20:41:30 +03:00
Max Romanov
1bb22d1e92 Unit application library.
Library now used in all language modules.
Old 'nxt_app_*' code removed.

See src/test/nxt_unit_app_test.c for usage sample.
2018-08-06 17:27:33 +03:00
Andrey Zelenkov
569a907dbb Tests: configuration of environment variables. 2018-05-29 15:29:01 +03:00
Andrey Zelenkov
7d224bfc9e Tests: added tests for SERVER_SOFTWARE variable. 2018-05-21 16:41:33 +03:00
Andrey Zelenkov
a44d358f29 Tests: added test for callable write() in Python. 2018-04-26 17:37:24 +03:00
Andrey Zelenkov
f6c3ef7ed3 Tests: added Python test with not iterable object. 2018-04-05 17:55:06 +03:00
Andrey Zelenkov
a01a98ce36 Tests: more Python tests. 2018-04-02 17:03:41 +03:00
Andrey Zelenkov
efb71121b9 Tests: added Python test with iterator context. 2018-04-02 17:03:41 +03:00
Andrey Zelenkov
f0df93ee3b Tests: HTTP header field and value tests. 2018-03-16 17:45:25 +03:00
Andrey Zelenkov
09f2009df5 Tests: reworked python tests with application. 2018-02-20 20:34:41 +03:00