summaryrefslogtreecommitdiffhomepage
path: root/test/test_php_application.py (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-11-02PHP: allowed to specify URLs without a trailing '/'.Andrew Clayton1-0/+44
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>
2022-09-07Tests: minor fixes.Andrei Zeliankou1-10/+1
2022-04-11Tests: style.Andrei Zeliankou1-7/+4
2021-12-12Tests: fixed type of applications.Andrei Zeliankou1-3/+3
2021-12-11Tests: added more OPcache tests.Andrei Zeliankou1-12/+53
2021-12-10Tests: fixed path to the "php.ini" file.Andrei Zeliankou1-2/+10
2021-11-09Tests: PHP shared opcache test added.Max Romanov1-0/+17
2021-10-18Tests: style.Andrei Zeliankou1-1/+0
2021-05-07Tests: PHP test with getting variable before the script is loaded.Andrei Zeliankou1-2/+12
2021-04-08Tests: preserving unit.log when run without restart.Max Romanov1-24/+15
Introducing "unit.log.Log" class for "unit.log" file management. Moving "findall()" function into TestApplicationProto. Using "os.kill()" to send signals.
2021-04-05Tests: style.Andrei Zeliankou1-5/+9
2021-01-14Tests: added missing checks for configuration results.Andrei Zeliankou1-15/+15
2021-01-13Tests: style.Andrei Zeliankou1-1/+0
2021-01-12Tests: unit_stop() removed where possible.Andrei Zeliankou1-6/+10
Since wait_for_record() was introduced there is no need to stop Unit before parsing unit.log.
2020-12-10Tests: added tests for PHP_AUTH_* variables.Andrei Zeliankou1-0/+58
2020-12-06Tests: options moved to the separate class.Andrei Zeliankou1-1/+1
This change is necessary to separate the logic and prevent possible circular dependency.
2020-11-11Tests: added a test for fastcgi_finish_request() function.Andrei Zeliankou1-0/+26
2020-10-19Tests: fixed unit.log print.Andrei Zeliankou1-5/+6
2020-10-06PHP: compatibility with 8.0.0 RC1.Valentin Bartenev1-5/+5
This closes #474 PR on GitHub.
2020-10-07Tests: minor fixes.Andrei Zeliankou1-2/+3
2020-09-16Tests: migrated to the pytest.Andrei Zeliankou1-287/+208
2020-07-28Tests: added PHP test with time check in error log messages.Andrei Zeliankou1-0/+26
2020-05-15Tests: style.Andrei Zeliankou1-1/+1
2020-04-24Tests: introduced module version specification in prerequisites.Andrei Zeliankou1-1/+1
2020-04-14Tests: minor fixes and style.Andrei Zeliankou1-4/+6
2020-03-03Tests: chdir() and open() for PHP module.Tiago Natel de Moura1-4/+131
These tests ensure optimizations in the chdir calls don't break SAPI semantics.
2020-02-20Tests: added PHP test with invalid index extension only.Andrei Zeliankou1-0/+30
2020-01-23Tests: check for php extension.Tiago Natel de Moura1-1/+11
2019-09-14Tests: refactored prerequisites model.Andrey Zelenkov1-1/+1
2019-07-17Tests: added PHP tests with "script" and "index" options.Andrey Zelenkov1-0/+39
2019-07-08Tests: added PATH_INFO variable test.Andrey Zelenkov1-1/+3
2019-07-05PHP: improved response status code handling.Valentin Bartenev1-0/+40
There's no reason to parse "http_status_line"; the PHP interpreter already does this. If the line contains a valid status code, it's assigned to "http_response_code". This also fixes invalid status line handling, where the nxt_int_parse() function returned -1; it was cast to unsigned, yielding response code 65535.
2019-05-30Tests: adjusted skipping tests.Andrey Zelenkov1-2/+1
2019-04-09Tests: speed up tests.Andrey Zelenkov1-0/+3
2019-04-09Tests: simplified module checking.Andrey Zelenkov1-2/+1
2019-03-28Tests: unit module refactoring.Andrey Zelenkov1-6/+5
2019-03-26Tests: style.Andrey Zelenkov1-121/+209
2019-03-01Tests: made tests compatible with PHP 5.3.Andrey Zelenkov1-3/+3
2019-02-28Tests: fixed PHP "disable_functions" and "disable_classes" tests.Andrey Zelenkov1-64/+54
2019-02-27Tests: added "Host" and "Connetion" headers where necessary.Andrey Zelenkov1-5/+7
Also minor header organizing.
2018-12-24Tests: more QUERY_STRING tests.Andrey Zelenkov1-0/+27
2018-11-28Tests: PHP directives "disable_classes" and "disable_functions".Andrey Zelenkov1-0/+110
2018-11-15Tests: added command line arguments parsing in tests.Andrey Zelenkov1-1/+1
Added the following command line arguments: -d, --detailed: Show detailed output for tests Usage examples: ./test/run.py --detailed python3 test/test_access_log.py --detailed python3 test/test_access_log.py -d TestUnitAccessLog.test_access_log_ipv6 -l, --log: Save unit.log after the test execution Usage examples: ./test/run.py -l python3 test/test_access_log.py -l python3 test/test_access_log.py --log TestUnitAccessLog.test_access_log_ipv6
2018-09-06Tests: used relative path for configuration.Andrey Zelenkov1-9/+9
2018-07-11Tests: more php.ini options tests.Andrey Zelenkov1-0/+74
2018-06-07Tests: added tests for "precision" option in php.ini.Andrey Zelenkov1-0/+12
2018-05-22Tests: initial PHP application tests.Andrey Zelenkov1-0/+122